On the dynamics of internal waves in a nonlinear, weakly nonhydrostatic three-layer ocean