NbN superconducting nanowire single-photon detector fabricated on MgF2 substrate