Open IMAIN earlier in solver.

This allows any messages printed in the parameter-loader to go to the
correct file.
Refactor mesher's IMAIN initialization to match solver.