Not able to save (to_csv) large file
#### Code Sample, a copy-pastable example if possible

```python
"""Pandas bug."""
from numpy.random import choice, seed
from pandas import DataFrame
from pandas.util.testing import rands_array

seed(1234)
N = 5 * 10 ** 6

DTF = DataFrame({'Col{}'.format(k): choice(rands_array(10, 750), N) for k in range(65)})

print(DTF)

DTF.to_csv('File{}.csv'.format(N)
```
#### Problem description

to_csv exception, eventually linked to latest version regression #21471 issue with to_csv with compression

#### Expected Output

Expected no exception

```bash
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/frame.py", line 1745, in to_csv
    formatter.save()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/io/formats/csvs.py", line 166, in save
    f.write(buf)
OSError: [Errno 22] Invalid argument
```

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Darwin
OS-release: 17.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.1
pytest: None
pip: 10.0.1
setuptools: 39.0.1
Cython: None
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

</details>