Slightly better error logging on exit.