Here is an example to illustrate what I mean:
#include
#include
#include
int main(void)
{
int
"The example above seems to work only for one write and one read."
That is because after one read and write your code exits. You need to keep writing in a loop and reading in a loop to achieve continuity. It does not seem to have anything to do with the FD close. As mentioned in an earlier reply you need one end on each process so the other is closed.
I hope I understand the query right.