Fix stream close