Closing the db on exit