Since you did not post any code, this is my best guess on how to help you.
Have you used the DISABLE ESCAPEKEY command in your code? If not, you will need to add it or you will need to use a different key to exit the program. If you decide to use the ESC key to exit, I would suggest putting the command in right before your main loop. After the program exits your main loop, simply use the STOP ANIMATION command before the END command.
Please use the DISABLE ESCAPEKEY command with caution. Bear in mind that if your code has a loop in it that will not allow it to get back to your main loop, your only way to get out of the program is Control-Alt-Delete.
Hope this helps,
LB
So many games to code.......so little time.