terminate console command with error code

if the script has caught an error, it must be terminated with an error code