Fix bug with not executing doctests in MantidPlot properly.

Refs #9639