Normally you should be able to exit from LaTeX after an error with the e, q, or x commands. If things get really wedged and none of these work, then your first recourse should be an interrupt signal, which you can usually send by hitting ctrl-C (i.e. holding down the ctrl key and pressing the C key).
If that doesn't work, then your next step should be a stop signal, which you should be able to send by hitting ctrl-Z. After sending a stop signal, you should then kill the stopped process, as otherwise stopped processes will just sit around taking up memory. You can kill the process which you just stopped by entering the following command:
If neither of these work, then you pretty much have to switch to another window and use the ps(1) command to track down the offending process and kill(1) it. This should be basic Unix knowledge, so if you are unfamiliar with this procedure, you should consult an introductory Unix book or ask someone nearby for help.