Implemented rd_close