I recommend switching to a new layout with no triggers, in fact nothing at all, on it to avoid this.
You can also add an If condition at the beginning of all your triggered scripts. If a variable is set, say $$triggers.off = 1, then Exit Script. Then set $$triggers.off = 1 at the start and clear it at the end of the script.
Why are you navigating between tabs during a script? Usually it's unnecessary.
As it is, the point is that I am not navigating between tabs during scripts run from a given tab panel. It appears that any action in a script that resets focus - to anything - results in the triggering of OnTabSwitch.
There are instances where necessary and appropriate scripts on a tab panel do their work on layouts that do not contain tabs or tab panels and this almost always - and for reasons not altogether clear - causes yet another iteration through the script associated with the OnTabSwitch event…There are even cases where the "CurrentTabPanel" returned is incorrect, resulting in totally anomalous behavior.
In short, I'm totally unclear on just what triggers the OnTabSwitch script, or the characteristics of triggering events. These events should be precise enough in their definition that there is no doubt whatsoever as to how to employ events for a desired result.
Posting copies of your scripts, and even better, your file would help a lot.