Contractual Externalities and Systemic Risk