Don’t re-close a closed output stream.

Fixes #1541 for 3.0.
Merge pull request #1545 from rspec/fix-1541-for-3.0

Don’t re-close a closed output stream.