fix hist range, bins and file close