resolved a bug when opening the file to copy, the NULL check on the pointer was on the taget file