Fixes #24142: [configparser] always join multiline values to not leave the parser in an invalid state
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 3a9fb56..af5aca1 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -1102,10 +1102,10 @@
                         # raised at the end of the file and will contain a
                         # list of all bogus lines
                         e = self._handle_error(e, fpname, lineno, line)
+        self._join_multiline_values()
         # if any parsing errors occurred, raise an exception
         if e:
             raise e
-        self._join_multiline_values()
 
     def _join_multiline_values(self):
         defaults = self.default_section, self._defaults