An ab initio approach to polarity inversion of AlN and GaN films on AlN substrate with Al overlayers: an insight from interface energies