Fix race condition in xmpp session cleanup.

Change-Id: I606748d076a7f60359ed9b701c593658856e8be8