Simpler approach to storing sort order

Instead of a dict mapping group ID to sort position, just use a list of the group IDs.  The order of the list is the sort order.

Note: I also tried just storing the sort order on the groups themselves (inside GroupItems.groupItems), but that doesn't work, because the information isn't saved/restored with the browser session.
Added handling to prevent showing Panorama UI when closing last tab in group

This involved fixing some other bugs related to group opening/closing
Now when you close the last tab in a group, it switches to the left group (or to the right group if you closed the last tab in the leftmost group)
There is still one slight peculiarity: if you undo closing the last tab in a group, the tab is reopened in the newly-focused group --- that is, the closed group is not recreated.  This is probably too hard to fix; it seems to mean that closing a tab group is not an undoable action.