The 5 second delay is due to the firing of the SWS(Silly Window Syndrome) avoidance timer. The SWS timer is scheduled to send the remaining data which is less than 1 MSS (Maximum Segment Size, 1460 bytes) and the receiver is supposed to send an ACK advertising the increased receive window and indicating that the remaining data bytes can be sent.
However, if the receiver sends an ACK when it can be ready for sufficient buffer within 5 seconds, the SWS timer cannot recover the 5 seconds delay status due to a race condition.
Note: For more information on SWS, please refer to Internet RFC 813 and RFC 1122. For more information on MSS, please refer to Internet RFC 879.