fix a crashed bug in cs_close(): call destroy function before freeing handle's memory