IT Consultant (anonymous)

Scenario: An IT consultant setups a CCPA while resident in Canada. After 4-6 year, this IT consultants decides to move to USA permanently for 2 or more years. Let’s assume that CCPA has about $1M in retained earnings at the time of departure of which $200K is in cash and rest is invested in stocks/portfolio.
a) What happens to retained earnings? Is there a departure tax on these?
b) Now that the CCPA owner is not Canada resident, it won’t be a CCPA anymore. In this case, can the IT consultant still without cash annually? How are taxes calculated?