Fix race condition in xmpp session cleanup.

Change-Id: I41c89a8c6219056123e5c48aa0c26748cf931a3d