Metal-semiconductor transition in thin film MAPbI3perovskite