fix closed streams