Fixed shallow copy issue.
LogCloseFile is now passed to atexit