To give a sense of the problem, this elaborate interlock works *sometimes*.
This leads me to believe that implementation of the switch, itself, is
getting in the way.  There may be an easy way to work around it, but that
probably requires factoring in the switch operation, and maybe changing it.