Added a function to the event emitter to close the stream