Don't re-close a closed IO (for 2.99)

This should fix #1541.  I'll forward port to 3.0 when we get confirmation this fixes the error for the user.