closeFinally

fun AutoCloseable?.closeFinally(cause: Throwable?)

Closes this AutoCloseable, suppressing possible exception or error thrown by AutoCloseable.close function when it's being closed due to some other cause exception occurred.

The suppressed exception is added to the list of suppressed exceptions of cause exception.