I am not sure that will help but. If it's beeping, your loop is still running for sure. However, What does not loop is your button 2 handler. So in order, to make your loop stop you need to press on button12.
Furthermore, there is a double equal sign (==) at line 19. This can also explain what happens.
I hope it helped !