Avoid a race condition where log and err both try to close the sigsafe fds
Part of #31594 (moved).
I think we might want a separate ticket and changes file for this.
Part of #31594 (moved).
I think we might want a separate ticket and changes file for this.