Unlock the mutex in case of error when opening cursor.