Shutting down gracefully when facing a startup error.

Fixes #585