Switch modes: reopen current sketch in new mode editor if file extension is compatible.

I also created an explicit enum to express the intent of the second argument to handleClose, which helped me understand the code while fixing it.