Fix race condition in xmpp session cleanup.

Change-Id: I939f06db90e929dc34b05a4b80e426fe04d691ce