It is only legal to `return` from a function or sourced script. The right builtin to use here is `exit`.