The Gibbs energy cost of cavity creation depends on geometry