Fix error handling in CLI mode, use STDERR and non-empty exit code (#1489043)