I would suggest using a WAIT function for 100 mSec or so in the main loop. If you don't have that, the main loop will poll your button at a million times per second or more. There's no need to poll the thing that fast - it will starve any other loops.
It means that you will respond to the QUIT button at most 100 mSec later - not a big deal, usually.
