Fix race condition in xmpp session cleanup.

Change-Id: I88f740341dd29e8e8c81e8815113d8f2d26271ac