Tidy up database connections