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

Thanks for Catalin Iacob for the patch.
diff --git a/Lib/StringIO.py b/Lib/StringIO.py
index 340fae1..f74a066 100644
--- a/Lib/StringIO.py
+++ b/Lib/StringIO.py
@@ -266,6 +266,7 @@
         8th bit) will cause a UnicodeError to be raised when getvalue()
         is called.
         """
+        _complain_ifclosed(self.closed)
         if self.buflist:
             self.buf += ''.join(self.buflist)
             self.buflist = []