make sure fdopen always closes the fd in error cases (closes #21191)
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index a597a67..195a4a8 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -463,8 +463,9 @@
    .. index:: single: I/O control; buffering
 
    Return an open file object connected to the file descriptor *fd*.  The *mode*
-   and *bufsize* arguments have the same meaning as the corresponding arguments to
-   the built-in :func:`open` function.
+   and *bufsize* arguments have the same meaning as the corresponding arguments
+   to the built-in :func:`open` function.  If :func:`fdopen` raises an
+   exception, it closes *fd*.
 
    Availability: Unix, Windows.