diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index a09247fae4..03c2b8e665 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -366,8 +366,14 @@ archive_close_connection(int code, void *arg)
 			 * fail to detect it because there would be no EOF condition on
 			 * the other end of the pipe.)
 			 */
+#ifdef WIN32
+			EnterCriticalSection(&signal_info_lock);
+#endif
 			if (slot->AH)
 				DisconnectDatabase(&(slot->AH->public));
+#ifdef WIN32
+			LeaveCriticalSection(&signal_info_lock);
+#endif
 
 #ifdef WIN32
 			closesocket(slot->pipeRevRead);