Saving to a file during parallel computation

I think it would be cleaner to just do return or something, instead of exit().

This doesn’t matter for your specific example if each worker runs for days anyway, assuming I understood that part of your problem correctly?