Legacy mode: gracefully handle closing IJ1 app frame

Description

If you are in legacy compatibility mode you are able to close the IJ1 app frame. After this IJ2 is confused. You can switch back to modern mode. But any open IJ1 windows do not close (though their IJ2 counterparts open).

We should capture the IJ1 app close event and perhaps just switch back to modern mode. Or close IJ2.