Fixing the error if no file was open