No, he couldn't, the widely discussed breakup fee in the contract was a payment if the merger could not be completed for specific reasons outside of Musk’s control.
It wasn’t a choice Musk was able to opt into.
OTOH, IIRC, he technically wasn't forced to because he completed the transaction voluntarily during a pause in the court proceedings after it was widely viewed as clear that he would lose and be forced to complete the deal.