         dbg("pid=#{pid}, signal=#{signal}")
         if pid
             try
-                process.kill(-pid, signal)
+                @_clear_execute_code_queue()
+                process.kill(-pid, signal)   # negative to kill the process group
             catch err
                 dbg("error: #{err}")
 

        f = (mesg) =>
            if mesg.parent_header.msg_id == message.header.msg_id
                dbg("got message -- #{JSON.stringify(mesg)}")
                mesg = misc.copy_with(mesg,['metadata', 'content', 'buffers'])
                # TODO: mesg isn't a normal javascript object; it's **silently** immutable, which
                # is pretty annoying for our use. Investigate.  For now, we just copy it, which is a waste.
                mesg = misc.deep_copy(mesg)
                if opts.all
                    all_mesgs.push(mesg)
                else
                    opts.cb(undefined, mesg)
                if mesg.content?.execution_state == 'idle'
                    @removeListener('iopub', f)
                    if opts.all
                        opts.cb(undefined, all_mesgs)
            else

            fs.unlink(@_kernel.connectionFile)
            delete @_kernel
            delete @_channels
        if @_execute_code_queue?
            for opts in @_execute_code_queue
                opts.cb('closed')
            delete @_execute_code_queue

    dbg: (f) =>
        if not @_dbg?
