Fix race condition in xmpp session cleanup.

Change-Id: I55ae0372b64515627495938b4065744e7c1cdb5f