They're able to change their money (in either direction) within that country. I gather you're referring to countires similar to The Republic of Moldova, where you cannot purchase the currency outside of Moldova, only within.
Also, in many countries who are closed, there's a thriving black market, which often have better rates than the banks.
I just wondered because I know that Iran is a closed curency and my boyfriends dad (who's Iranian) can't bring back any of the money he has in Iran because it's a closed currency, thats how he explained it to me anyway
Yes, this has been similar for the South African Rand. In Iran there are countless black-market money changers. However, when you depart the country, you must make a declaration as to whether you have any Iranian Currency in your possession (similar to all CIS countries, Moldova, Etc). Should you lie and be caught...well...I'd hate to think the consequences. But there ARE ways to overcome this.
The airline industry has an amazing degree of infamy as participants (they claim ignorance...but can we talk?) in the transfer of billions of pounds a year. It's even a relatively simple process. But I do know it's being watched more these days by national security groups.