correctly delete mapdb files on close
write and merge field metadata