raise an ValueError in getvalue() on closed StringIO (closes #12161)

Thanks for Catalin Iacob for the patch.
4 files changed