Prevent database connection leaks