bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6366)

(cherry picked from commit c869529ea9fbed574d34cf7ac139ca3f81b62ef0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 9525ad6..6a684f2 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -4152,9 +4152,10 @@
     }
 
     if (save(self, obj, 0) < 0 ||
-        _Pickler_Write(self, &stop_op, 1) < 0)
+        _Pickler_Write(self, &stop_op, 1) < 0 ||
+        _Pickler_CommitFrame(self) < 0)
         return -1;
-
+    self->framing = 0;
     return 0;
 }