The "CTR_TX" bit of the USB endpoint register indicates when the transmit is done.
But all is managed under interrupt by the ST library, that calls the appropriate callback functions, depending on the endpoint and the interrupt.
In your case, when a transmit is correctly finished, the EPx_IN_Callback is called. I think you can use it to manage the transmission and to ensure that there is no overwritten data.