Fix head_index to restore the correct tuple
Add message latencies to the peer output section

This gives a general idea of which streams are taking more or less time.
Extract end-of-stream cleanup to close_stream