- Did I do well by posting the answer?
You've basically followed the guidance at How long should I wait before providing the answer to my riddle? — offered hints, and waited plenty of time. (A bounty would have potentially drawn more attention to it, and maybe someone would have had the needed insight to complete the solution, but that can be hit or miss.)
Having said that, it is generally nicer and more satisfying to everyone to give a bit of a helping hand to the people who've put time and effort into coming up with a solution, so they can arrive at the final solution themselves. When an existing answer is generally correct but has missed a relatively small piece, it's probably best to give them some directed guidance and/or to annotate their final solution with (e.g.) "Added by OP" notes that fill in missing or incorrect details.
In this case, it looks like Gareth McCaughan had solved the majority of the puzzle and arrived, in a different way, at the final answer (more or less); a few indirect hints were unfortunately insufficient to shed new light on the bit that was missing. I personally might have just given a very direct hint to get the thing solved. Usually, self-answers here are done because the other answers are so far off base that the OP feels that providing a complete answer is the only way to really salvage things.... and that doesn't seem appropriate here.
As an alternative, accepting the mostly complete answer and filling in the missing detail, either as a commment or as a direct edit with a note as mentioned earlier, would be an option for just getting the solution out there once and for all.
- Should I accept my own answer as best? Or the one from the user that got the closest?
It's always the OP's call which answer to accept. The checkmark, by awarding extra recognition (and reputation) to a given answer, is a good way to reward the answer that you feel "best" answers the question—and the criteria for that are entirely up to you. If you want to emphasize the correct intended answer with the checkmark, that's up to you. If you want to recognize the closest answer given by a solver, or even the answer that made the most tangible contribution toward the final answer, by giving it the checkmark, that's up to you too.