Replaced inner shutdown hook classes with lambdas.