             process.addListener "SIGHUP", =>
                 # re-open our log file
                 console.log "w3c reloading log file"
-                @close()
-                @open()
+                @close => @open()
                 
         #----------
         

                    # existing file...  don't write headers, just open so we can 
                    # start appending
                    initFile = false
                
            @file = fs.createWriteStream @options.filename
            
            @file.once "open", (err) =>   
                console.log "w3c log open with ", err
                if initFile
                    # write our initial w3c lines
                    @file.write "#Software: StreamMachine\n#Version: 0.1.0\n#Fields: c-ip date time cs-uri-stem c-status cs(User-Agent) sc-bytes x-duration\n"

                @once "flush", =>
                    @_opening = false
                    console.log "w3c open complete"
                    cb?(false)
                    
                @flush()
                            
        #----------
            
        close: (cb) ->
            @file?.end()
            @file = null
            
        #----------

                # for a valid w3c log, level should == "request", meta.
                logline = "#{meta.ip} #{strftime(new Date(meta.time),"%F %T")} #{meta.path} 200 #{escape(meta.ua)} #{meta.bytes} #{meta.seconds}\n"
            
                if @file && !@_opening
                    # make sure there aren't any queued writes
                    unless _u(@queued).isEmpty
                        q = @queued
