There were a number of times my clients POS would crash during a credit card processing.
How to avoid?
You might want to run the program in debug mode and start a credit card processing. When the program is about to crash, debugger will stop the execution of code. From this you will get a clue about what is going wrong in the code at that point.
I've had this happen
either clean or replace the reader. Many I found in the field were so dirty they wouldn't pass a card easily. If cleaning don't work, replace the reader unit or if modulized, the reader heads.