write_io.openFile = fptr;
fptr.cleanup(runtime, false);
/* should not finalize fptr because another thread may be reading it */
return context.nil;
} finally {
if (locked2) wfptr.unlock();
}
}
if (fptr.isWritable()) {
throw runtime.newIOError("closing non-duplex IO for reading");