 
       input: => @input()
 
-    client.onStdout (s) => @stdout s
-    client.onStderr (s) => @stderr s
-    client.onInfo   (s) => @info s
+    @subs.add client.onStdout (s) => @stdout s
+    @subs.add client.onStderr (s) => @stderr s
+    @subs.add client.onInfo   (s) => @info s
 
   deactivate: ->
+    @c.close()
     @subs.dispose()
     history.write @c.history.items
 

    atom.packages.activatePackage('language-julia').catch(->).then =>
      @c.setModes @modes
      @c.reset()
    @c.onEval (ed) => @eval ed
    client.onWorking => @c.loading true
    client.onDone => @c.loading false
    atom.views.getView(@c).classList.add 'julia'
    history.read().then (entries) =>
      @c.history.set entries


module.exports =
  activate: ->
    @subs = new CompositeDisposable

    @create()

    @subs.add atom.config.observe 'julia-client.maximumConsoleSize', (size) =>
      @c.maxSize = size

    client.handle
      info: (msg) =>
