Fix some crashes and deadlocks

Here are some changes to remove compile warnings and fix stability problems.  The highlights are:

* Make the frontend check for ERROR_IO_PENDING before waiting for a write to complete.  This fixes a hang in the front end went the interperter process dies as just the wrong time.
* Don't crash the interpreter if the stack size is > 100 or we could not determine the name of a script at a certain level in the stack.
* Don't deadlock the interperter if __tostring or __towatch calls lua_error() while stopped on a breakpoint.