flush file after saving it