Read from one file and write to another in different threads