Uniqueness in inverse acoustic and electromagnetic scattering with phaseless near-field data at a fixed frequency