Issue #21742: Set stream to None after closing.