Fixing bug on overwrite file to finalPath