Correct mode is now selected in modeMenu

This resolves [Issue #2615](https://github.com/processing/processing/issues/2615), where trying to change the Mode when there are unsaved changes doesn't change the mode, but shows the mode as being changed in the modeMenu popup. What has been done is that in case there are unsaved changes in the sketch, the last mode is selected again.