EHN: to_csv compression accepts file-like object
- [x] closes #21227 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Handle an unsupported case when a file-like object instead of path passed into to_csv with compression. According to documentation, compression keyword requires it to be a filename.

At the moment, when a handle is passed, it appears to be uncompressed.

Tentative enhancement.