Close database connection after processing.