Fixed concurrency bug when resizing the output file using a read/write lock