In the case of Having trouble with assigning Vars ... it would be worthwhile closing because the OP has answered his own question and moved on. I would like to be able to close the question so that it no longer appears in the "Unanswered" pile (which is HUGE) but the current options for closure don't cover the situation appropriately.
There is no reason to close a question just because the OP answered the question, just like there's no reason to close a question just because it was given a good answer by another user. Someone else might come along with a better solution to the problem and post and answer; even if the OP already has their solution, other solutions can still be helpful to future readers finding the question through Google.
If the OP has answered the question via comments or editing the question, then you should ensure that the content is moved to an answer. Either comment and ask the OP to move the answer to an answer, or just post the content as an answer yourself. If you do, be sure to quote/attribute the content appropriately. You can also mark the answer as community wiki to as a means of not taking credit for another's content.
The only reason you'd want to close a question like that is if the answer is something that couldn't possibly be determined by any other user. If the question itself simply didn't have enough information in it to come to the answer the OP arrived at, then it's possible the question is "not a real question" or "too localized". (Too localized would be something like, "Oh, I was actually running the wrong program." or, "There is actually a typo in this variable name.")