midx: fix broken free() in close_midx()