Fix for log file handle remaining open on restarts

Close the log file prior to starting a new subprocess so the log file doesn't remain locked by previous instance.