fix a hang in the frontend when the lua process terminated unexpectedly
don't wait for writes to complete if the reason for the original
write failure wasn't ERROR_IO_PENDING.
Fix a compile warning in Visual Studio 2012
Fix an assert failure when closing a file in the frontend and
a compile warning.
a few fixes to edge cases...
1) don't crash if the stack size is greater than s_maxStackSize
2) don't crash if we couldn't retreive the name of the current script
   stack
3) don't deadlock if we fail to evaluate __towatch while paused