Fix hang when MantidPlot shuts down on RHEL6

Refs #7819