Define __file__ when we %edit a real file.

Old behavior:
```
In [1]: %pycat test_script.py
print(__file__)

In [2]: %edit test_script.py
 done. Executing edited code...
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    176             else:
    177                 filename = fname
--> 178             __builtin__.execfile(filename, *where)

/home/bfroehle/src/ipython/test_script.py in <module>()
----> 1 print(__file__)

NameError: name '__file__' is not defined
```

New behavior:
```
In [1]: %pycat test_script.py
print(__file__)

In [2]: %edit test_script.py
 done. Executing edited code...
test_script.py
```

Closes gh-2765.