python thread handle keyboardinterrupt