There used to be a difference between "military town" [voennyi gorodok] and "closed town" [zakrytyi gorod]. The first would be a military encampment, pure and simple, while the second would be a more or less isolated [hence separate] town or city with important defense production or research facilities. Sometimes these facilities were sited in "open" cities, like Khrunichev airspace plant in western Moscow.
Still in use today, what the Soviets extremely ingeniously did was hide all the production facilities and even rocket test stands so it looked like apartment blocks! The latter was extremely ingenious because they hid all the flame and noise damping systems underground so the test stands could operate without people noticing nearby. That was why the American intelligence agencies scratched their heads for years and years trying to find Soviet rocket engine test stands out in the "boonies" of the Soviet Union; in reality it was done at a Moscow suburb!