Bug fix for closing file handle. Update for Windows 7 support.