midx: use existing midx when writing new one