closing database after every use