It's not absolutely necessary after the first write, but I could add it. I add the flush just to make sure that the user is informed that the operation is "done" as soon as possible.