אֲנִי קֹהֶלֶת הָיִיתִי מֶלֶךְ עַל יִשְׂרָאֵל בִּירוּשָׁלִָם׃
You are reading a lot into a Qatal verb that just isn't there.
First, not even in English is it the case that saying "I was X" means you are no longer X. For example, "I was king when they attacked" does not mean the speaker is no longer king. It just means that in the past event that happened - the attack -- the speaker was king. Whether he is still king now is irrelevant.
Similarly Qatal is often used in the past to locate an event in relation to another -- which is why some translations use "have been king" (ESV, NET2)
You often see this template in recounting a story, that the main verbs are wayiqtol with milestones in qatal. E.g. As I was walking [wayiqtol] a man came up to me [qatal] and a dog barked [qatal]. The wayiqtol forms the bones of the outline and then sub-points that happened within that outline are described with qatal.
Bottom line, all you can infer from the qatal is that the speaker was king when the larger events of that chapter were taking place. To attempt to infer that he is no longer king now would not be with the authorial intent.
Please train yourself to avoid these types of inferences rooted in English idioms when reading the Bible. Always keep in mind that the Bible is translated, and it's hard enough to convey the surface meanings correctly without dragging in all the inferences in the target language. This requires a careful and disciplined approach to reading the Bible, which is why consulting other translations and commentaries, as well as studying some basics of Hebrew, goes a long way to help avoid making these types of inference errors.