use

inline suspend fun <T : AsyncCloseable?, TR> T.use(block: (T) -> TR): TR

Executes the block with the AsyncCloseable as parameter, and closes the resource once done.