I am pretty sure this is the same issue everyone else is experiencing with TC9 performance wise. WaitWindow or FindChild or FindAllChildren all have the same problem, sometimes they will only detect the window after the timeout has fully passed, for no reason at all. I suggest someone escalates this on your end and actually take a look at reproducing it, as I and others see this issue reoccurring routinely in TC9. This is the one major performance issue I have with TC9.
Besides, reading his code, he does wait 5 seconds every time, he just retries 20 times. 5 seconds is an eternity for a programmer.