Exit with an error on memory allocation failure. Fixes #458

Lua API docs say:
>LUA_ERRMEM: memory allocation error. For such errors, Lua does not call
the error handler function.