I thing You can't clear canvas because in the end you are setting variable Mode to Moving, while clean canvas works only when Mode is ChooseMove. If you will disable line (System / Set "Mode" to "Moving") it will start working
This is unfortunately not the case. a) I believe the full line of code still runs even if part of it involves disabling the conditions that start it to run halfway through and b) I've moved the set mode line to the end of the line and it still works. Even setting a on keyboard space pressed > clear canvas line completely outside of this code block didn't work.
As discussed above, it seems like it's a bug. I'll get around to reporting it when I can.