There is no way for the program to distinguish between an EOF that means "it's time to quit" and an EOF that means "a writer is done, but there may be more input from someone else".
If you have the ability to modify the behaviour of your program, then do the reading in an infinite loop (one iteration lasts until EOF) and send it a specific command string that means "time to quit". Sending that string would be the task of the send_eof command in your question.
Another option:
( echo some stuff; cat more_stuff.txt ) >P or
{ echo some stuff; cat more_stuff.txt; } >P