do the shutdown hook as an inline anonymous function instead of creating an inner class for it