         @socket.write cmd+"\n"
 
     save: ->
+        if not @online
+            console.log "[ratom] Error saving #{path.basename @tempfile} to #{@remoteAddress}"
+            message.display "Error saving #{path.basename @tempfile} to #{@remoteAddress}", 2000
+            return
         console.log "[ratom] saving #{path.basename @tempfile} to #{@remoteAddress}"
         message.display "Saving #{path.basename @tempfile} to #{@remoteAddress}", 2000
         @send "save"

                switch m[1]
                    when "token"
                        @token = m[2]
                        @make_tempfile()
                    when "data"
                        @datasize = parseInt(m[2],10)
                        @should_parse_data = true


    open_in_atom: ->

        @send ""

    close: ->
        @online = false
        @send "close"
        @send ""
        @socket.end()
