Fix dt-cli & make export code nicer

There were some concurrency issues lurking in the disk.c code. I don't
know if I got rid of all of them, and I didn't look into other imageio
places yet.