Changelog: - fix integer overflow Upstream Changelog: - Wait until all data are sent before closing connections.