Use shutdown hook