add unit test for writing to already open file
- [ ] closes
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

closes #21577 
The added unit test will pass for `0.23.0`, fails for `0.23.1`, passes for `master`.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=h1) Report
> Merging [#21696](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/dc45fbafef172e357cb5decdeab22de67160f5b7?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21696/graphs/tree.svg?src=pr&token=eZ4WkYLtcO&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #21696   +/-   ##
=======================================
  Coverage    91.9%    91.9%           
=======================================
  Files         154      154           
  Lines       49657    49657           
=======================================
  Hits        45638    45638           
  Misses       4019     4019
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.28% <ø> (ø)` | :arrow_up: |
| #single | `41.9% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=footer). Last update [dc45fba...f018837](https://codecov.io/gh/pandas-dev/pandas/pull/21696?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 @chris-b1 @gfyoung can you have a look.  does this close #21577 - is this a bug? or is it fixed by the recent fixed regression in to_csv? > does this close #21577 - is this a bug? or is it fixed by the recent fixed regression in to_csv?

@jreback : I would close #21577 with this PR.  Seems to have been addressed somehow on `master`. thanks @jdrudolph 