Add a brief sleep after shutting down sessions in test teardown

This fixes a test failure for me on my Windows VM. See the comment for
details.
Merge pull request #7226 from takluyver/win-sleep-session-tests

Add a brief sleep after shutting down sessions in test teardown