Fix race condition in xmpp session cleanup.

Change-Id: I2031b9aacb65f7b9d1e9f18cfc35683402b7b43e