add shutdown hook