Partial revert of 1c52e92 and 160f43c to fix regression

Refactoring in 1c52e92 inadvertently changed the logic of the code and broke the "Cancel" button such that it would cancel the plugin's execution, but never trigger the "Fail" event to let the controller/FormMain know that the operation was canceled.