Can this occur?
Use case 1: Python itself deletes the file* 
yes it can happen. I just tested like this:
In [1]: with open("file.txt", "w") as f :
   ...:     f.write("Something Old")
   ...:
In [2]: !cat ./file.txt
Something Old
In [3]: import os
   ...: with open("file.txt","w") as f:
   ...:     os.remove("./file.txt")
   ...:     print f.write("Something new")
   ...:
None
In [4]: !cat ./file.txt
cat: ./file.txt: No such file or directory
Use Case 2: Other than python deletes the file. 
Then also, found the behavior to be same. 
In [1]: !cat ./file.txt
Something Old
In [2]: import os
   ...: import time
   ...:
   ...: with open("file.txt","w") as f:
   ...:     time.sleep(15)
   ...:     print f.write("Something new")
   ...:
None
In [3]: !cat ./file.txt
cat: ./file.txt: No such file or directory
How to avoid it? 
You can use exclusive lock from fcntl.lockf() 
Edit: There is one more caveat here. Locking the file may not be straight forward and may be OS dependent like What is the best way to open a file for exclusive access in Python?