While loop triggered logic outside the loop many times?

I have a rule machine that tries to run a while loop to turn on my TV.

The rule is as follows

Upon inspecting the logs, I found that the commands after the while loop seemed to have run for more than 1 time. Specifically, keyPress('Home') on Family Room TV ran for more than 1 time even if it was outside the while loop - given only one trigger.

Any chance I have a bug in my code or is the behavior of the while loop buggy by any chance? Any help is appreciated!

Logs are here