Fix: clean lock files on Windows.

Closes #2931 and #2909.