Fix corner case in XmppChannel close that causes assertion to fail later.