Improved heralded single-photon source with a photon-number-resolving superconducting nanowire detector