use

inline fun <C : Closeable, R> C.use(block: (C) -> R): R

Executes the given block on this resource and then closes it whether an exception has occurred or not.