Write uncaught exception to file