Fix race condition in xmpp session cleanup.

Change-Id: I5fbb00a76a333f6b1dea2e19c2c1c1e3cd2079d4