Fix jq -e and BEGIN/END interactions

Also, exit 5 when invalid input JSON texts cause jq to exit.
Test jq -e and BEGIN/END interactions