properly decref the return value of close()
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 9e14b4f..6f7af41 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -455,11 +455,13 @@
 
   error:
     if (result != NULL) {
-        PyObject *exc, *val, *tb;
+        PyObject *exc, *val, *tb, *close_result;
         PyErr_Fetch(&exc, &val, &tb);
-        if (_PyObject_CallMethodId(result, &PyId_close, NULL) != NULL)
+        close_result = _PyObject_CallMethodId(result, &PyId_close, NULL);
+        if (close_result != NULL) {
+            Py_DECREF(close_result);
             PyErr_Restore(exc, val, tb);
-        else {
+        } else {
             PyObject *exc2, *val2, *tb2;
             PyErr_Fetch(&exc2, &val2, &tb2);
             PyErr_NormalizeException(&exc, &val, &tb);