That’s basically any gced language and the fix is present for decades at this point: try-with-resources, ‘using’, ‘with’ (with-whatever IIRC can be traced back to Lisp…)
No, every time you have something that sound like "you just have to [...]" it means future bugs that were entirely preventable. The only correct way in c++ is to wrap it in a unique_ptr or handle type so that fclose gets called automatically when you are done with the resource