Improved in-use file cleanup in preparation for dependency upgrades on Windows