     @fakeRow.remove()
     {cols, rows}
 
+  exit: ->
+    pane = atom.workspace.getActivePane()
+    pane.destroyItem(this);
+
   destroy: ->
-    @detachResizeEvents()
+    @off 'focus', @focus
+    $(window).off 'resize', @resizeToPane
     if @ptyProcess
-      @ptyProcess.terminate()
-    @term.destroy()
-    parentPane = atom.workspace.getActivePane()
-    if parentPane.activeItem is this
-      parentPane.removeItem parentPane.activeItem
-    @detach()
+      @ptyProcess.kill()
+      @ptyProcess = null
+    if @term
+      @term.destroy()
+      @term = null
+    if @disposable
+      @disposable.dispose()
+      @disposable = null
 
 
 module.exports = TermView

        @emitter.emit('data', data)
        @term.write data

      @ptyProcess.on 'exit', ->
        @emitter.emit('exit', data)
        @destroy()

    @input "#{runCommand}#{os.EOL}" if (runCommand)

    term.focus()

    @applyStyle()
    @attachEvents()

    window.TermView = this

  resize: (cols, rows) ->
    return if @term.rows is rows and @term.cols is cols

      colors, cursorBlink, scrollback, cols, rows
    }

    term.on "data", (data) => @input data
    term.open this.get(0)

