Fix seg fault when quitting a session with more than 1 browsed file.

edit, browse, edit, browse, quit, seg fault.
Because AutoCompartment was acting on the current window,
and in this case that's wrong.
It needs to act on whatever window is being freed, which may not be
the current window, as in q5 to quit session 5.