make sure fdopen always closes the fd in error cases (closes #21191)
4 files changed