How can I do this in a more performant way? I'm concerned that throwing the data in a queue like this is defeating the purpose of yield from the open() and also how about handling the shared reference to file handle?