Fix timer pointer not being reset when a timer is killed

The timer pointer is compared against NULL in timer_process_timers()
but in fact it is never set to NULL once create, even when the memory
is freed by timer_kill()!!
Replace hard-coded ENOMEM with errno
Fix crash when a timer is killed from within its callback
Fix timer callback being passed a wrong timer ID
Add more assertions in internal timer APIs
Add an error check to catch array_append() failure
Document the timer API
Use plugin_address_to_handle instead of sampgdk_get_plugin_handle