Reworked API cleanContext psql sub-process execution (refs #4261)

The exit code from the psql sub-process was not correctly reported.

Connection errors from psql will be reported has error exit code, but SQL
errors in the .sql files will not trigger an error exit code.