Updates to fix Windows crash errors

Handles exceptions properly. Stops crashing on Windows upon exit or applying settings.