FormulaInstaller: flush before closing writes.

This seems to help the problem with `brew install -v` sometimes truncating output.

Closes #24666.