Handle the hash tables better when loading/unloading the script.

The `on start` event now checks for the hash table when starting. Without this
the rest of the commands in the `on start` event will fail to execute.

The `on unload` event was added to save/free the hash table if someone was to
unload the script.

The `on exit` event is just a force of habit.