GUI: Add a couple of functions to the scripting environment relating to focused elements.
Reorder a few operations to prevent a crash.
Whitespace.
Don't crash when trying to close a NULL file.
A slightly better way of creating an empty file from the scripting environment.

The only change here is doing a check for null after opening the file handle
and before closing it.