Improves return code handling

The processing spinner indicator was causing the return exit code of the
finished background job to not be returne correctly; was removed where
the exit code of the job was important.
Also improves code structure in terms of exiting and error messages.