Fix race condition in xmpp session cleanup.

Change-Id: I7316cece732f48c25c273faea7411776a2073b08