Correctly free libuv handles

This ensures memory chunks for libuv handles are only freed after the event loop
no longer has references to it.