Add write cache flush to sync()