A Macroeconomic Model with Financial Panics