df.to_csv ignores compression when provided with a file handle
#### Code at issue

```python
with open(outputfile, "w") as file_handle:
    df2.to_csv(file_handle, compression='gzip')
```
#### Problem description
The written file is not gzip compressed.

#### Expected Output
The output should be a gzip compressed csv file. Similar to what is obtained when using:
```python
df2.to_csv('/path/to/file.csv.gz',compression='gzip')
```
