unix, windows: add uv_loop_alive() function

Useful to know when the the event loop is empty, this can't be done with
uv_run() without possibly blocking, or running some events (which might
empty the event loop as a side-effect).
process: Emit 'keepalive' event before exit

If the event listener schedules more work, the loop will be restarted,
otherwise, exit proceeds as usual.