 
     /// Flush the stream's buffer.
     func flush()
+
+    /// Signal that the byte stream will not be used further and should be closed.
+    func close() throws
+}
+
+// Default noop implementation of close to avoid source-breaking downstream dependents with the addition of the close
+// API.
+public extension WritableByteStream {
+    func close() throws { }
 }
 
 // Public alias to the old name to not introduce API compatibility.

            stream.writeJSONEscaped(string)
        }
    }
}

/// Define an output stream operator. We need it to be left associative, so we

        // Do nothing.
    }

    public final func close() throws {
        try closeImpl()
    }

    @usableFromInline func closeImpl() throws {
        fatalError("Subclasses must implement this")
    }

    @usableFromInline func writeImpl<C: Collection>(_ bytes: C) where C.Iterator.Element == UInt8 {
        fatalError("Subclasses must implement this")
    }
