Last Call for Life: Habitability of Terrestrial Planets Orbiting Red Giants and White Dwarfs