Quantitative Electrochemical Control over Optical Gain in Quantum-Dot Solids