I gave it a try. It still crashes. It seems when the button is pressed, it fails to load the procedure and just crashes.
I think it is necessary to stop the script after pressing the button. Add "halt" after the button line.
That worked! Thanks for the help.