canClose method added to streams.