Free energy from replica wormholes