TXE flag isn't cleared after a SPI send
TXE (TX empty) is a hardware control register and will always be set as long as you are not transmitting. If you finished sending stuff and have nothing else to send you should disable the interrupt TXIE (TX interrupt enable bit (I think it's in CR1 register).