Closing last window in group ends scene.

Fixes a bug when closing the last window of a scene
didn't properly remove the scene and restore the previous one.