When a corporation or LLC does business in a state other than its state of formation (known as a foreign state) it is required to qualify to do business in that state. When it stops doing business in a state in which it had qualified, it can withdraw from that state.
Although it is not required to withdraw, it is to the benefit of the corporation or LLC to do so. Until it formally withdraws, a corporation or LLC remains subject to the foreign state’s annual report, franchise tax, and other compliance obligations. If it fails to comply, it will be subject to monetary penalties which the states can seek to collect.