When detecting the pushbutton press, just wait until you detect that it has been released, then continue.
Also suggest you add some de-bounce code to stop extra/false detections.