Phase-locking of a terahertz solid-state source using a superconducting hot-electron bolometer mixer