Pass the file reference to each thread