[MRG] histfactory: write_measurement improvements