Please actually say:
 * what file or directory is created at the outset that's going to be in something's way later
 * what tries to create a directory or file with that same name later and why does it do so
I am unable to work these things out from reading the code, so I have no idea what's happening here !