Influence of Mg doping on the morphology and optical properties of ZnO films for enhanced H2 sensing