Make half-created files empty.

File creation is a two-step process, first the file is created and
then it is populated with data. If the second step fails, the file is
left in an inconsistent state which damages the containing
project. This change causes half-created files to return as empty.

Change-Id: I09147e8eb389b249dde57862d07063434df4f0a3