as Closeable
Wraps a Sequence into a CloseableSequence with a custom close action.
This function allows you to associate a specific action to be executed when the resulting CloseableSequence is closed.
Return
a CloseableSequence that wraps the original sequence and executes the specified action on close
Parameters
T
the type of elements produced by the sequence
on Close
the action to be executed when the sequence is closed