Don’t keep trace files open, reopen them each time
Keeping files open at all times prevents them from being cleaned up properly, and when clean-ups happen, the existing code couldn’t handle it properly and would either error out, or continue logging into an invisible file (referenced to only by its open file descriptor).