This isn't quite right.  It needs to replace any session ids.  Otherwise
i) prev session has some old sessions.
ii) new session created
iii) an old session removed - will be removed from current, but not prev.
iv) new session closed.

Now the current session will have the old session in its list, even though it has gone.