Revert "Avoid possible memory leaks by ensuring stream closures"

This reverts commit d11d6a6262d35f062e292de76aa45f2e9020bd29.