Fix race condition in xmpp session cleanup.

Change-Id: I0250c1ecefddc9932b50cbf198cc9bf76ce8fe2d