Electrical and optical properties of NiO films deposited by magnetron sputtering