Do they get rid of TLDs once the country they are assigned to goes away? I assumed they'd sell them to someone or something.
They might not have much of a choice but to shut down all .io domains. This video explains a little: https://www.youtube.com/watch?v=1yJ6AZsUlpc
Yes, it will be deleted; see: https://www.iana.org/help/cctld-retirement
Nobody really knows. There are only a few precedents, i.e. the old Soviet Union .su tld being kept around, or the 2 letter country code that I can't recall which was reassigned to a new country after the old one went out of existence.
There isn't really a precedent for a tld with as many domains under it as .io, it's a very strong possibility it will be kept around and given to a private entity or even to GB.