When exiting, return the last error, instead of keeping a separate exit code. Changed the error variable to long, for consistency.