Try to stop goroutines from leaking, not sure if this is all that's needed:

```go
defer close(stream)
```