Better handle errors when something goes wrong writing partitions (#154)