Added a clean shutdown of the database.