Fix race condition in xmpp session cleanup.

Change-Id: Ib19754216b61c8c9a32d2aaf6386ecc022889cab