I tried it again, I removed the Channel = 0 in the @init (I don't think we actually need it anyway so I will get rid of it from future versions). I did the same test again but I still have the hanging notes.
We need a variable that is set when a KS is recieved, then we can check if we have recieved a KS and if we have we turn off all notes that have been turned on. I don't have time to do any code at the moment but I'm sure that it's something like that that is needed.
For testing purposes do the same as I did. One track, one input, one multitimbral VSTi on the track with two patches loaded on individual channels. Add the keyswitch script and hold down a note then press a key switch, the note should continue to play because it hasn't recieved a note off.
Let me know if you can reproduce the problem.