static void _close(AutoCloseable c) { if (c != null) try { c.close(); } catch e { // Some classes stupidly throw an exception on double-closing if (c instanceof javax.imageio.stream.ImageOutputStream) ret; else throw rethrow(e); } }