fixed bug where .tmp file did not get renamed to .csv in some cases (VBAT-65 , VBAT-68)