Well, I need to keep both pipes open during the "session", since usual radare2 session involves hundreds of commands and their output. Opening a new pipe and process every time is a wrong way to go in my opinion.
You should be able to open the pipes at the beginning of the session, and close them after, passing the pipe variables around as needed. Prolog wouldn't be any different to other programming languages there. What errors are you getting? Maybe post to the swipl mailing list?
I will send a message to mailing list then, thanks for the suggestion.