fix #1366 and make r_io_close keeping the current desc if it does not get close