Only write indexes to disk if they changed.