A modified conjugate gradient method for minimizing the energy in the removal of free-surface-related wavefields