Measurement of the D0 lifetime