Abort thread properly