That's why I recommend using a server from the two sites I linked to (https://joinmastodon.org/servers and https://fedi.garden). All of the servers listed on those sites have promised to give three months warning if they intend to shut down, so that there's time to find another server and transfer your account.
The migration has to happen before the old server shuts down, so this commitment to a warning period is important.