       ideViewLength  = 0
       ideViewLength += ideView.tabView.panes.length  for ideView in @ideViews
       delete @generatedPanes[pane.view.hash]
+
+      if session = pane.view.remote?.session
+        @mountedMachine.getBaseKite().removeFromActiveSessions session
 
       @statusBar.showInformation()  if ideViewLength is 0
 


  createNewTerminal: (options) ->

    { machine, path } = options

    unless machine instanceof Machine
      machine = @mountedMachine

    unless @fakeViewsDestroyed
      @fakeFinderView?.destroy()
      @fakeTabView?.removePane_ @fakeTerminalPane
      @createNewTerminal { machine, resurrectSessions: yes }
      @setActiveTabView @ideViews.first.tabView
      @fakeViewsDestroyed = yes

