Use write() instead of end() on the output stream

This avoids errors when the output stream is `process.stdin`.