Close streams on error