A fix for orphaned SQL connection.
Finish fixing orphaned SQL connections