close

open suspend override fun close()(source)

Closes the transport. When called after start, waits for in-flight outbound messages to be flushed, releases the input source and output sink, cancels the internal scope when the transport owns it, and invokes onClose. When called before start, transitions directly to the closed state without releasing the input/output or invoking onClose — the caller remains responsible for resources that were never handed off to a running transport. Safe to call multiple times and safe to race with start.