close

open override fun close()(source)

Cleans all retained ownership in descendant-first order.

Close is confined to the execution owner and non-reentrant. It records TreeState.Closed before any cleanup callback. It clears retained ownership and pipeline-held references before cleanup and remains closed even when cleanup fails. Cleanup visits descendants before parents and later siblings before earlier siblings. Cleanup attempts detach only after an attach attempt. Cleanup disposes every claimed node. Cleanup continues after failures and rethrows the first Throwable instance with later distinct failures suppressed. A repeated close after the operation has returned is a no-op.

Throws

when the operation is called from another execution owner or re-enters an active operation.

when a cleanup callback fails. The first cleanup throwable is propagated unchanged after all cleanup attempts.