add database shutdown hook