Implement some keepalive feature
The burp2 status port should stay open for a long time, burp closes the socket after some timeout. The workaround is to setup a very long timeout.
The right solution is to implement some sort of "pinging" feature that will periodically interact with the server in order to keep the session open.