python catch keyboardinterrupt in thread