Added common code for handling our new stream closing paradigm and changed the library to use it