     ///     - itemCount: The number of items we tried to write.
     ///     - result: The result of the write operation.
     private func didWrite(itemCount: Int, result: IOResult<Int>) -> OneWriteOperationResult {
-        let (fulfillPromises, result) = self.state.didWrite(itemCount: itemCount, result: result)
+        let (promise, result) = self.state.didWrite(itemCount: itemCount, result: result)
 
         if self.state.bytes < waterMark.low {
             channelWritabilityFlag.store(true)
         }
 
-        fulfillPromises()
+        promise?.succeed(result: ())
         return result
     }
 

                    unaccountedWrites -= headItemReadableBytes
                    /* we wrote at least the whole head item, so drop it and succeed the promise */
                    if let promise = self.fullyWrittenFirst() {
                        promises.append(promise)
                    }
                } else {
                    /* we could only write a part of the head item, so don't drop it but remember what we wrote */
                    self.partiallyWrittenFirst(bytes: unaccountedWrites)

                    // may try again depending on the writeSpinCount
                    return (fulfillPromises, .writtenPartially)
                }
            }
            assert(unaccountedWrites == 0, "after doing all the accounting for the byte written, \(unaccountedWrites) bytes of unaccounted writes remain.")
            return (fulfillPromises, .writtenCompletely)
        }
    }


            self.isOpen = false
        }

        self.state.removeAll()?.fail(error: error)

        assert(self.state.isEmpty)
    }
