Close stream in `ArrowWriter.finalize` before inference error
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`.
_The documentation is not available anymore as the PR was closed or merged._