fixed log file closing, fixed chat and log commands