Close stream in `ArrowWriter.finalize` before inference error
_The documentation is not available anymore as the PR was closed or merged._
Ensure the file stream is closed in `ArrowWriter.finalize` before raising the `SchemaInferenceError` to avoid the `PermissionError` on Windows in `incomplete_dir`'s `shutil.rmtree`.