dispose of file properly