Domain-wall dynamics near a quantum critical point