Fix thread stop for Py3