REGR: write compressed pickle files with protocol=5
- [x] closes #39002
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

I don't know why the change from #37056 fails in combination with `protocol=5` and compression. @ig248

An alternative fix would be to have `get_handle` insert a write buffer for all compressions (similar to #38728) to avoid if/else in format specific `to_*` 

