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?

How exactly do you think the governments are going to do that? You have been told that cryptocurrencies, especially Bitcoin, are decentralized, so how do you expect the government to go about a thing like this? If you look at countries where Bitcoin has been banned, you will realize that people still continue to make use of Bitcoin despite the ban that has been put in place by the government.
This is because Bitcoin can be sent through P2P exchanges, or wallets. So transactions with Bitcoin are basically peer to peer, and people can be doing this and there won’t be any trace of it. So the government can’t stop it. They can only stop you from using exchanges that are centralized.