Optimizing the stoichiometry of ultrathin NbTiN films for high-performance superconducting nanowire single-photon detectors