No amount of terraforming will save the Earth when the sun dies and takes out half the solar system with it. There are other dangers too that make it irresponsible to leave all of humanity on one planet. Our survival as a species depends on us being able to survive on multiple worlds in multiple solar systems, or at the very least being able to sustain ourselves on interstellar ships.
It's unlikely that humans exist then. Speciation or calamity will intervene.
If you have infinite energy, your planet never "dies out", because you can terraform it at will.