Measurement of the W mass in e+e− collisions at production threshold