Ensured that each thread writes to itsown file