It is allowed to write an answer for the question you asked.
What is valid for other questions is still valid for self-answered questions, though. Self-answered questions are not exempt from being closed, and this means (for example) that "What is the antonym of beautiful?" would still be closed as general reference, even if you would provide a detailed answer, and report the full spectrum of words between beautiful and ugly.
Self-answered questions are also expected to have a very good answer. If the answer is on the line of "It doesn't exist such a word." given together the question, it is probable the question would get many down-votes, and possibly closed.
Generally, it is also preferable to give other users the time to read the question, and provide an answer.
The main reason is giving the time to the users to decide if the question is worth to be kept open, suggest any changes to the question, or ask any information necessary to answer the question. IMO, writing a detailed answer for a question that would be closed as general reference sounds like forcing the hand of who would close the question.
The other reason is that it sounds unfair. Suppose that a friend of mine asks me about a problem he has with his Drupal site, and I tell him I will give an answer in 5 days, without suggesting him to ask on Drupal Answers. After 5 days, in which I had the time to verify the answer I was going to give, prepare my answer with any documentation reference, or references to code used by other module maintainers (including Drupal's maintainers), I write the question, and my answer. I am the first one to write the answer, and I had all the time to prepare it; for sure there isn't nobody who can write a better answer. Even if somebody could write a better answer, I still have 5 days the other users didn't have to look for an answer.
Notice that It's OK to Ask and Answer Your Own Questions doesn't say that you need to immediately answer your own question, nor that basic self-answered questions are fine, nor that a self-answered question is immune from closing votes.
It simply says that if somebody asked a question for which s/he has found the answer, s/he can answer her/his own answer. That is surely better than deleting the question; at least, the question, and its answer could be useful to future readers.