support stream closing