Move the all-encompassing try-catch to the server proper.

This has the advantage that, when started not in server mode, the solver terminates with a failure exit code if there is a problem.
Do not trust the presence of the port file but check if the server is really listening

This guards against failures during early startup phases of the server, where the server cannot yet properly communicate the problem to us (the client).
Improved error handling in shell scripts.

The scripts should now terminate abnormally if something goes wrong along the way.