How Self-Sustaining Space Habitats Could Save Humanity from Extinction