Fix problem with tempfile on Windows platform

On Windows, it seems to be the case that performing a mv on the tempfile will fail with a permission denied error. Some research indicates that this is either a bug in Ruby on Windows or possibly the tempfile implementation on Windows uses file locking. Regardless, while a mv operation fails with permission denied, a cp operation will usually still succeed.

This PR implements a begin-rescue which will attempt a cp operation if the mv operation fails with permission denied.