One more go at making the shutdown hooks work right.