#17585: merge with 3.3.
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index b1ef4ca..13dd8e1 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1368,6 +1368,9 @@
         self._line_buffer = line[size:]
         return line[:size]
 
+    def close(self):
+        self.shell.close()
+
 
 usage_msg = """\
 
diff --git a/Lib/site.py b/Lib/site.py
index acaeb3e..a954704 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -350,12 +350,7 @@
             # Shells like IDLE catch the SystemExit, but listen when their
             # stdin wrapper is closed.
             try:
-                fd = -1
-                if hasattr(sys.stdin, "fileno"):
-                    fd = sys.stdin.fileno()
-                if fd != 0:
-                    # Don't close stdin if it wraps fd 0
-                    sys.stdin.close()
+                sys.stdin.close()
             except:
                 pass
             raise SystemExit(code)
diff --git a/Misc/NEWS b/Misc/NEWS
index 7be4c6d..d3c9c26 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1060,6 +1060,8 @@
 IDLE
 ----
 
+- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit().
+
 - Issue #17657: Show full Tk version in IDLE's about dialog.
   Patch by Todd Rovito.