Missing log information in the final trial (with movie stimuli)

Hello, I am a beginner psychopy user with little handle on coding. I am finding this curious issue that only the final trial misses one set of information (in my case event name) when all the preceding trials have complete information. I would be grateful for any tips or advice on this. Many thanks, Maki

OS (e.g. Win10): Mac OS 10.15.6
PsychoPy version (e.g. 1.84.x): 2020.1.2
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I would like all of my 18 video trials to have a recorded log of event name but the 18th trial does not record its event name, all other trials (1-17th) record this successfully. The actual data themselves are being successfully recorded for all the trials, which makes this issue rather intriguing but also frustrating.

What did you try to make it work?: I confirmed this was happening by changing the loop to run sequentially from randomly and saw it was always the 18th trial which is not recorded.
I am unsure as to what next.