In general no, however you could set up the program to terminate sections of itself with the appropriate On Escape, OKL, KeyPreview or Error Handling routines. What exactly seems to be your problem - it's always easier to solve a particular situation, rather than a general one. Have you got so code that's not working right?
Rick