I haven't done any debugging with writing values since i don't ever need to use them, makes me sad how broken these functions are

.
Ok, i spent a few hours trying to read my own code

and made some fixes with writing and finalizing functions. The only problem is it's not writing the very last line in csv file.
I'll try to fix that and implement suggested changes and functions in the original code/post in a short period of time.
P.S. Original post updated. I ran a few quick test and it seems to be writing values and saving copies just fine now.
P.P.S. There is one more bug that i have no idea how to fix as of now. If Any row contains duplicate data in separate columns and you attempt to overwrite only the later value, both will be overwritten. For instance if your row contains "1,2,3,1,4" and you need to overwrite only the fourth column, not the first one, function will replace both

.