Elon stated his reasons for selling quite explicitly:
-------
"In the (hopefully unlikely) event that Twitter forces this deal to close and some equity partners don’t come through, it is important to avoid an emergency sale of Tesla stock."
"so if the twitter deal doesnt close, will you buy Tesla stock again?"
"Yes"
Source: https://twitter.com/elonmusk/status/1557199046741094400
------
TSLA is about to do a stock split, and the price is expected to go up as a result. If anything this was the worst time to sell. If he ends up buying back in later, it will be at a loss. Where's the gains here?