Use an atomic write from port -> Erlang

When the port was run under strace and on slow systems, the writes were
sent as separate messages to the Erlang process.