Semiconductor-to-Metal Transition in Carbon-Atom Wires Driven by sp2 Conjugated End Groups