Shutdown hook done right.