Bug 626748 – Use async methods for writing and handle EAGAIN