Nonlinear stability of two-layer shallow water flows with a free surface