Use tkill instead of kill

This prevent stopping anything but main thread.