Modified the way to close libuv main loop.