NewtonSolver: Check for result of linear solve

The newton solver does not converge if the linear solver has not finished successfully. This patch checks for the result of the linear solve and exits the newton solver with a corresponding message, if there was an error.
The check is enabled by default, but can be disabled by a flag in NewtonSolver.
It has passed a "make check" on my machine