Moving process exit code to error handler. Ensuring selenium is stopped prior to outputting exit code