I have excluded memory usage as a cause, I have written a debug version of the script that does not save any results and thus uses practically no memory. Also running out of memory is usually foreshadowed by swapping, which is not happening. Also, it is usually accompanied by an error message.