Moved the defer syslogger.close to ensure that syslogger is defined