Exiting at random points probably means it IS ending legitimately. Anyway, you should instead be looking at the values variables have, etc, so that you can find out WHY it is exiting at that point, and then hopefully fix it.
Yeah the problem with that is my code is roughly 1500 lines. Is there no way i can find out where in the code the program is being told to end 'legitimately'?
Using your debugger, stick a breakpoint every hundred lines or so. Run the program under debug and you'll see which debug points are hit and not hit, giving you a much better idea of the exit point(s).