No, what's inside the loop will keep running.
But here the window is destroyed at the end of the function, after the loop. So as long as the loop is running, the window stays open because the function has not reached the point where it destroys the window yet.