Good question :) Sometimes there can be very little difference between the questions, it all comes down to how the community interacted with it on the day.
I think we can all agree that your first example needed to be closed - it was way too broad. We want to be nice to the newbies and help them out, but we still have limits. As a mod my votes are binding so I try not to be the first one to cast close votes* - but in this case it was pretty obvious that the question needs to be tightened up a lot.
The second example is considerably different, the OP took a lot more time and effort to describe what they want. This question - while not canonical - has now become a benchmark one. This means that new questions on the same topic need to show how they are different otherwise at the very least they will be closed as a duplicate. Of course this doesn't mean that you can't answer the new question before it gets closed, and the closed question can always be reopened at a later date if it is edited sufficiently.
*Personally I think that while a mod can still do regular community duties they should be circumspect when doing so. If a mod is too prolific with voting and maintenance they can end up dictating the direction of a site and making it their own rather than the community's. Usually when I cast a vote I'm the 4th or 5th to do so, unless it is in response to a flag.