Merge test_startfile fix from 3.2.
diff --git a/Lib/test/test_startfile.py b/Lib/test/test_startfile.py
index 7a003eb..dd505bf 100644
--- a/Lib/test/test_startfile.py
+++ b/Lib/test/test_startfile.py
@@ -11,6 +11,7 @@
 from test import support
 import os
 from os import path
+from time import sleep
 
 startfile = support.get_attribute(os, 'startfile')
 
@@ -23,6 +24,10 @@
         empty = path.join(path.dirname(__file__), "empty.vbs")
         startfile(empty)
         startfile(empty, "open")
+        # Give the child process some time to exit before we finish.
+        # Otherwise the cleanup code will not be able to delete the cwd,
+        # because it is still in use.
+        sleep(0.1)
 
 def test_main():
     support.run_unittest(TestCase)
diff --git a/Misc/NEWS b/Misc/NEWS
index f46c4de..62eb3ab 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -985,6 +985,8 @@
 Tests
 -----
 
+- Fix test_startfile to wait for child process to terminate before finishing.
+
 - Issue #10822: Fix test_posix:test_getgroups failure under Solaris.  Patch
   by Ross Lagerwall.