IMHO it would be sufficient to write:
``else if (file)``

And please also check your indentation below!