Switch to pure write() for output to avoid flush()