at a point where I am getting exception making the output file