Fix Access Denied errors on Windows

Closes #907