Ambient effects on photogating in MoS2 photodetectors