If you try to overwrite your memory with a program that uses parallel processing, you should first verify that it’s worth it.
For instance, check if your disk is at 80%-100% writing speed; if that is the case, then your program could also just use a single core, because it is blocked by disk writing speed anyway.
If this is not the case, I recommend you to use the debugger or ad console/GUI outputs to your program to verify that everything gets executed in the right order.
If this does not help, then I recommend that you verify that you did not mess up the program (for example one arrow points in the wrong direction).