Don't exit - write error to STDERR

The error outputting from the CLI tool is inconsistent.

This pr uses `abort` which prints to `STDERR` and exits with a code of 1 for both invalid references and errors in the template.