Runnable (BaseStream a, BaseStream b) { return new Runnable() { @Override public void run() { try { a.close(); } catch (Error | RuntimeException e1) { try { b.close(); } catch (Error | RuntimeException e2) { e1.addSuppressed(e2); } finally { throw e1; } } b.close(); } }; }