Committing before removing connection to MySQL