Fix exception when no file is openned