       )))
 
 (defn cleanup []
+  (try
   (log "cleanup")
  ; (do-when #(.update %) (:display @state))
   (state-assoc! :finished true :display nil)

(defn make-summary-metadata [settings]
  (let [depth (core getBytesPerPixel)
        channels (settings :channels)
        num-camera-channels (long (core getNumberOfCameraChannels))
        super-channels (flatten (for [channel channels] (repeat num-camera-channels channel)))]
     (JSONObject. {
      "BitDepth" (core getImageBitDepth)
      "Channels" (count super-channels)

  (when (and (@state :init-continuous-focus)
             (not (core isContinuousFocusEnabled)))
    (core enableContinuousFocus true))
  (return-config)
    (catch Throwable t (ReportingUtils/showError t "Acquisition cleanup failed."))))

;; running events
  
