bug-22220: Check callbacks in connection close in case they have already been freed in another thread