Ensure that we close streams on exception