Bitcoin is a digital currency that circulates freely, without any control or supervision from banks, governments, or anyone else. In contrast, bitcoin relies solely on cryptography and software between computers.
what if the government closes or does not allow the exchange of Bitcoin or cryptocurrencies with the official currency in each country?

The government of a country can disallow the use of btc in the country but people use p2p means to still exchange btc to fiat currency, binance p2p is very effective and support many local currency, you can also use other p2p platforms that support your local currency to exchange btc to fiat.
Only countries whose government have legalise btc can trade openly, majority uses p2p to transact as of now.