Added flush to ensure current data saved to SD