I think the `f.close()` is redundant. If you want to make it more explicit, you could write
```
try:
    yield opener(fp, mode)
finally:
    f.close()
```