Now writing samples in 3 files
Now writing temp files for each node and then moving them when they are complete