         (def acq-sequence acq-seq) ; for debugging
         (execute (mapcat #(make-event-fns % out-queue) acq-seq)))
       (catch Throwable t
-             (def acq-error t)
+             (def acq-error t) ; for debugging
+             ; XXX There ought to be a way to get errors programmatically...
              (future (ReportingUtils/showError t "Acquisition failed.")))
       (finally
         (when cleanup?
           (cleanup))
-        (.put out-queue TaggedImageQueue/POISON))))
+        (if (:stop @state)
+          ; In the case where we canceled the acquisition via stop, it is
+          ; possible that the out-queue is full. But we have already given up
+          ; on sending images in that case, so it can't do any further harm to
+          ; drain the queue.
+          (if (.offer out-queue TaggedImageQueue/POISON)
+            nil
+            (do
+              (.clear out-queue)
+              (.put out-queue TaggedImageQueue/POISON)))
+          (.put out-queue TaggedImageQueue/POISON))
+        (log "acquisition thread exiting"))))
 
 ;; generic metadata
 

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


        camera-index-tag (str (. mmc getCameraDevice) "-CameraChannelIndex")
        image-number-offset (if (first-trigger-missing?) -1 0)
        image-queue (pop-burst-images total timeout-ms)]
    (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)))]
