         camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")
         image-number-offset (if (first-trigger-missing?) -1 0)
         image-queue (pop-burst-images total timeout-ms)]
-    (doseq [i (range total) :while (not (@state :stop))]
-      ;(println i)
-      (.put out-queue
-            (-> (.take image-queue)
-                (tag-burst-image burst-events camera-channel-names camera-index-tag
-                                 image-number-offset)
-                make-TaggedImage
-                ))))
-  (burst-cleanup))
+    (try
+      (doseq [i (range total)]
+        (send-tagged-image
+          out-queue
+          (let [image (try
+                        (.take image-queue)
+                        (catch RuntimeException e
+                          (if (.getCause e) ; unwrap rethrown exception
+                            (throw (.getCause e))
+                            (throw e))))]
+            (-> image
+              (tag-burst-image burst-events camera-channel-names camera-index-tag
+                               image-number-offset)
+              make-TaggedImage))))
+      (finally (burst-cleanup)))))
 
 (defn collect-burst-images [event out-queue]
   (let [pop-timeout-ms (+ 20000 (* 10 (:exposure event)))]

      nil)))

(defn collect [event out-queue]
  (condp = (:task event)
                :snap (doseq [sub-event (make-multicamera-events event)]
                        (collect-snap-image sub-event out-queue))
                :burst (collect-burst-images event out-queue)))

(defn z-in-msp [msp z-drive]
  (-> msp MultiStagePosition-to-map :axes (get z-drive) first))

    (select-keys event [:position-index :frame-index
                        :slice-index :channel-index])
    (when out-queue
      (send-tagged-image out-queue
            (make-TaggedImage (annotate-image image event @state (elapsed-time @state)))))
    image))

