Homoclinic solutions for nonautonomous second-order Hamiltonian systems with a coercive potential