Write to disk only when data has been modified