Trade Agreements with Heterogeneous Firms