Fix race condition in xmpp session cleanup.

Change-Id: I5a6bb97cd808d8598daa095bd1d9fd1433eebf83