The key to understanding this is that in the book of Ecclesiastes we essentially hear 2 voices.
The primary one is that of the "teacher". He provides the bulk of the books content - but his work is actually introduced and presented by another voice which is that of the "author".
The author has essentially "collected" the words and advice of the "teacher" and then presents them to the reader in this book. We can see this from the first line of Ecclesiastes 1:1 where the author gives us a very short introduction telling us that what he will present are not his words but are instead:
The words of the Teacher,[a] son of David, king in Jerusalem:
The next 12 chapters are essentially the "teaching of the teacher". Then at the conclusion of the book at the verse you mention 12:9 we once again return to the "authors" voice. Here the author essentially summarizes the overall work they have presented and give final words of advice about the teaching.
In this regard we can summize that the author using "past tense" means they have potentially collated the works of the teacher (believed to be Solomon) into this book after he died.
There is also a brilliant video from the Bible project which uses visualization to convey the two voices and the interplay between them which explains this much better then I ever could. Picture tells a thousands words :)
https://www.youtube.com/watch?v=VeUiuSK81-0&ab_channel=BibleProject