Destructors are a higher-level and safer approach.
That's a C++ specific limitation, it works just fine in C.