Refactor asyncWrite() to support both, arrays and UnsafePointer.