CloseFile würde immer ausgeführt werden.
Wird aber vorher kein Append oder Reset oder Rewrite ausgeführt, dann rummst es.
Das ist genau so wie man das nicht macht:
Delphi-Quellcode:
try
Foo := TFoo.Create;
...
finally
Foo.Free;
end;
so ist es richtig
Delphi-Quellcode:
Foo := TFoo.Create;
try
...
finally
Foo.Free;
end;
Stell dir jetzt vor was passiert, wenn bei der Erzeugung von Foo eine
Exception auftritt.
Im ersten Beispiel bekommst du noch eine
Exception hintendran, weil Foo.Free ausgeführt wird
Kaum macht man's richtig - schon funktioniert's

Zertifikat: Sir Rufo (Fingerprint: ea 0a 4c 14 0d b6 3a a4 c1 c5 b9
dc 90 9d f0 e9 de 13 da 60)