diff --git a/src/port/open.c b/src/port/open.c
index f37afc7512..dad328f000 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -135,6 +135,21 @@ pgwin32_open(const char *fileName, int fileFlags,...)
 				continue;
 		}
 
+		/*
+		 * ERROR_ACCESS_DENIED can be returned while the file is deleted
+		 * (Windows NT status code is STATUS_DELETE_PENDING).
+		 * https://stackoverflow.com/questions/3764072/
+		 * Try again for 1 second to check whether the "access denied"
+		 * condition persists.
+		 */
+		if (err == ERROR_ACCESS_DENIED) {
+			if (loops < 10) {
+				pg_usleep(100000);
+				loops++;
+				continue;
+			}
+		}
+
 		_dosmaperr(err);
 		return -1;
 	}
