Bug-22489: Fixed publisher code to close open file streams on read and writes.