How to end the Macro Loop?

Hi, I’m running a macro by “Play loop 1000 times”, and in between the loop, if the clicking success, it will open up a tab browser. My question is how to end the “Play loop” for 1000 times
or create a circuit breaker for the Looping, after it open up the tab browser before the loops end? Please help

I do not use loop default but I create a loop with gotoif or while command

https://ui.vision/rpa/docs/selenium-ide/gotoif

https://ui.vision/rpa/docs/selenium-ide/while