flush when write done