Fixing unending recursion when attempt to close a connection after a failed attempt to close a cursor.