Freezing-in dark matter through a heavy invisible Z′