The easiest way to get out of this situation is to map a Keyboard Shortcut for these commands. You can do this at any point (even after they have disappeared from the Ribbon). Simply open the 'Keyboard Shortcuts' dialog, and type 'Finish Sketch' in the box.
Then just map a suitable shortcut, like 'FS', to the command. As soon as you press OK, you can now use this shortcut to get out of the editing mode.