TCP Request: how to change address and close connection?

Hi experts!

Nodered is running on a raspberry pi (up-to-date) in a working environment with 2 identical SCPI measurement devices on different IP address. I need to communicate with one of them (user chooses wich one) but the connection to the other device must be (held) closed.

The SCPI devices have some requests with answers, but also some commands without any answer/reaction.

How can I achieve this?