Close database