Use the first option, having
Only having is grammatical and means that North Korea is approaching the point where they will have nuclear weapons.
The structure of the sentence calls for a present participle.
the form of a verb, ending in -ing in English, which is used in forming continuous tenses, e.g., in I'm thinking, alone in nonfinite clauses, e.g., in sitting here, I haven't a care in the world, as a noun, e.g., in good thinking, and as an adjective, e.g., in running water.
If that sounds confusing or unclear, let's take a closer look at the options we have, with the important points in bold.
have - present tense 1st and 2nd person singular, or present tense 3rd person plural
having - present participle
had - past tense 1st, 2nd, and 3rd person singular, past tense 3rd person plural, or past participle.
has - present tense 3rd person singular
We know that North Korea is third person. We also know that it's singular. The only thing in question is what tense to use.
We can eliminate had offhand because it only deals with past tense, and we can tell that the sentence "North Korea is getting closer to having..." is not about the past.
If we wanted to use present tense, we'd see that present tense 3rd person singular is has, as in:
North Korea has a nuclear weapon.
But that doesn't sound quite right in the context of the original sentence, because the word is structured to describe something ongoing, or more specifically, something that is close to being ongoing.
North Korea is getting closer to has a nuclear weapon
Sounds wrong, doesn't it? So we're left choosing between "have" and "having." But note from the definition outlined above that "have" in 3rd person can only function as present tense plural.
The countries have a nuclear weapon.
It doesn't work in singular, which we recall would use has.
North Korea have a nuclear weapon.
Since North Korea is singular third person, the only option we're left with for tense is present participle. So even if the term present participle is difficult to understand, we can deduce that none of the other forms fit.
North Korea is getting closer to having nuclear weapons.
To learn more about present participle and understand why it's appropriate in cases like this, google the term or take a look at this article in Grammarly.