Ensure error logs are flushed before quitting a process