change: reallocate event container when incremented number of registered events
fix: should be close fd even if error occurred
add: afd_loop, afd_loop_once and afd_unloop api added, and afd_wait has been removed.