Also, if you pull the power plug, neither finally blocks nor defers would run. I personally consider it a clear and obvious deficiency in the semantics (and the implementations) of those programming languages but everybody refuses to listen to me.
I certainly wouldn't mind if modern servers had something similar to make sure programs could stop gracefully. But then that doesn't help if you have a hardware failure...
[0] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/...
[1] https://devblogs.microsoft.com/oldnewthing/20170510-00/?p=95...