Robust Financial Contracting and Investment