There is a difference between "not being able to leave" and "not being able to enter", your examples are of second kind. Currently there are very few places that prevent people from leaving, e.g. North Korea, Turkmenistan, Xinjiang for Uighurs. East Germany and USSR in recent history.