                                                      (async/put! in (with-meta m {:host host})))
 
                                                    1
-                                                   (let [bais (ByteArrayInputStream. blob)
-                                                         reader (transit/reader bais :json)
-                                                         m (transit/read reader)]
-                                                     (debug "client received transit blob from:"
-                                                            url (take 10 (map byte blob)))
-                                                     (async/put! in (with-meta m {:host host})))))))))))]
+                                                   (with-open [bais (ByteArrayInputStream. blob)]
+                                                     (let [reader (transit/reader bais :json)
+                                                           m (transit/read reader)]
+                                                       (debug "client received transit blob from:"
+                                                              url (take 10 (map byte blob)))
+                                                       (async/put! in (with-meta m {:host host}))))))))))))]
      {:new-conns conns
       :channel-hub channel-hub
       :url url

                       (on-receive channel (fn [data]
                                             (if (string? data)
                                               (do
                                                 (debug "server received data:" url data)
                                                 (async/put! in
                                                             (with-meta
                                                               (read-string-safe @tag-table data)

                           (if (@channel-hub channel)
                             (do
                               (debug "server sending msg:" url (pr-str m))
                               (with-open [baos (ByteArrayOutputStream.)]
                                 (if (= (:topic m) :binary-fetched)
                                   (do
                                     (.write baos (byte 0))
                                     (.write baos (:value m)))
                                   (let [writer (transit/writer baos :json)]
                                     (.write baos (byte-array 1 (byte 1)))
                                     (transit/write writer m)))
                                 (send! channel ^bytes (.toByteArray baos))))
                             (debug "dropping msg because of closed channel: " url (pr-str m)))
                           (recur (<! out))))
                       (on-close channel (fn [status]
