Tidy up logging shutdown.