Fix race condition in xmpp session cleanup.

Change-Id: Iefc06440b687bcd6473ba16693af8eb5e5fdba38