fix close(fd_out) bug