It might be better introducing a bit more generic fix, like .close() method in an AbstractEventStream, so the resources the stream allocated during creation will be released explicitly upon .close() method call.