Fix script file handle treated as if opened though if failed

The file handle is incorrectly compared to 0; we had to compare to
INVALID_HANDLE_VALUE.

Also deleted some old commented codes.