Added automatic shutdown when init fails.