I feel a bit uneasy about wrapping the try/finally inside `with`. Could you please remove the outer level? This should be fully safe:
```python
f = opener(fp, mode)
try:
    yield f
finally:
    f.close()
```