close database connections at exit