Fix race condition in xmpp session cleanup.

Change-Id: I00d7807735f0923763d809e0ba8e9858142b8a00