Shutdown is triggered by exception.
Improved shutdown.