stm32f103rey6: fix thread exit