BUG: Ensure incomplete stata files are deleted
State: closed

Attempt to delete failed writes and warn if not able to delete

- [x] closes N/A
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: IO Stata
description: read_stata, to_stata

Comments:
Hello @bashtage! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/io/stata.py`](https://github.com/bashtage/pandas/blob/60f49a1e378589ed6dfad7a877453e3b037f603f/pandas/io/stata.py) !

 - There are no PEP8 issues in the file [`pandas/tests/io/test_stata.py`](https://github.com/bashtage/pandas/blob/60f49a1e378589ed6dfad7a877453e3b037f603f/pandas/tests/io/test_stata.py) !



##### Comment last updated on December 18, 2018 at 14:21 Hours UTC
xref #23573

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=h1) Report
> Merging [#24319](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/87e9496fca555e683e388db97b664471bb4a164f?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/24319/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #24319   +/-   ##
=======================================
  Coverage   92.28%   92.28%           
=======================================
  Files         162      162           
  Lines       51831    51831           
=======================================
  Hits        47833    47833           
  Misses       3998     3998
```

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


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24319?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/24319?src=pr&el=footer). Last update [87e9496...926a92c](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=h1) Report
> Merging [#24319](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2b5058e974bc30fdf80fb54914a0baaef8d43069?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/24319/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #24319   +/-   ##
=======================================
  Coverage   92.28%   92.28%           
=======================================
  Files         162      162           
  Lines       51835    51835           
=======================================
  Hits        47835    47835           
  Misses       4000     4000
```

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


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24319?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/24319?src=pr&el=footer). Last update [2b5058e...6b3f841](https://codecov.io/gh/pandas-dev/pandas/pull/24319?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@jreback This is ready now. 
thanks @bashtage