i still fail to see how you are actually debuggin this.

i see no iprintlns printing the filename its trying to write to.
i see no iprints whatsoever for debugging.

Are you sure you wanna fix this code or are you just wasting our time?