Measurement of the lifetime of neutral charmed mesons