Rework AsyncWriteEngine to be more reliable and faster.