add epoll_wait timeout (instead of infinite) - clean close and better signal handling