Process all pending GUI events before loading Mantid

Refs #10798