The point here is that a bounty on a question does raise the bar for closing it. A question that has a bounty on it both has spent some time out in the wild as a question (so wasn't closed as immediately obviously bad), and may have had some effort expended by users to answer. It also requires a moderator to intervene to close it (to remove the bounty).
As such, it is entirely correct that the bar is higher for closure (or, is lower for remaining open) - if for no other reason than it takes more moderator effort (and we shouldn't be using our scarce resources, i.e. moderator time, on closing questions unless it is egregious). The additional elements reinforce that.
I don't think it is the good answer solely that is the reason here, though; a truly terrible question with a good answer might be closed anyway. In this case, it is the combination of the good answer and the bad-but-not-terrible question which means it should be left open. What is a good book on Perl scripting? would still be closed, even if it had a good answer or answers. This question, though, in my opinion is not all that bad - it could be better, certainly better worded if nothing else, but it asks how to accomplish a particular programming task, and in particular how to accomplish a task that might well be desired to be accomplished by many others - meaning this question and the answers it derived likely improved the quality of our database, whether or not the question is truly all that.
On a side note: remember why we close questions. We close questions largely because they are not good enough to be easily answered in a way consistent with our philosophy. While you may believe this question wasn't easily answerable in a way consistent with our philosophy, it did get an answer, and one I would suggest is sufficiently within our site's philosophy. So to that extent, the answer does validate the question - even if it wasn't a question you believe was a good one to start with. Perhaps that is indeed evidence that it was a better question than you thought to begin with.