Multithread filewriting