Write uncaught exception to file lastException.log before termination