use

inline suspend fun <Type : Closeable, Return> Type.use(action: suspend (Type) -> Return): Return(source)

Executes the given action block on this Closeable resource and ensures that the resource is closed after the block execution, whether it completes normally or with an exception.