On occasion I noticed that voting to close "duplicate of" instantly closes the question and marks it as a duplicate.

I've seen it happening for identical questions (reposts) and that makes sense. It also happened with this question here.

I'm just wondering how does SO (currently) determine that the question to be closed should rather be closed instantly instead of simply recording my vote?