onFailure

fun <T> onFailure(closeables: Collection<AutoCloseable>, block: () -> T): T

What block gives; when it fails, closeables (those opened so far, in order) are closed (inReverse) and its failure thrown as it was, with any failure to close suppressed by it.