Fixed #21122 -- Improved clean up of test temp directory on Windows

- Fixed test that didn't close the files it opened
- Catching and handling exception when temp directory cannot be removed
- Fixed an unrelated bug that affects `bisect_tests()` under Python 3
  (having to do with true division always returning a float)