Fix race condition in xmpp session cleanup.

Change-Id: Ic6710dab2e9a6f71aceaeceaab03bab80dcc1daf