use

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

Execute block then close this. This will be closed even if block throws.