Use AutoCloseable in IO.withCloseable to cover more cases