Improved energy extrapolation with infinite projected entangled-pair states applied to the two-dimensional Hubbard model