Minor fix to safe_popen fd close logic