Updated snapshot script to flush and compact.