BUG: Enable stata files to be written to buffers
Enable support for general file-like objects when exporting stata files

- [x] closes #21041
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry
