use ui.writeError in lib/cli/cli.js

fixes GH-2254
@fivetanley friendly reminder!