Fix unit tests on Windows.

Fixes #5068