Not sure where it exactly does that and what behaviour you expect. Could you provide more information?
My code is a bit different than yours, and since I'm on the beta the code won't run any more, so I cannot try your code.
Anyway: Is it possible your issue is because of using the loop:
while !isOnOpenSwitch ?
This causes Byte to try wo walk forever. I therefore used a for (for i in 1 ... 14) loop instead, so Byte stops once the's walked the scene