The sample on GitHub is showing a simple open, do stuff, close pattern. It’s just showing off all the capabilities in a simple but functional snippet of code. It is not an example of how you should build things as you don’t want to close your connections after each request. You’ll want to hang on to them and reuse them as they cost resources to create.
Your approach of closing the connection when the program is done—on an exit event handler or a SIGINT event handler—is fine. Much better than what I’ve done in the past, which is just let them hang!
However, I would suggest using Node Redis to open and close the connection and then handing the Node Redis connection to redisgraph.js. This will allow you to use the connection for more mundane Redis operations as well. Plus, Node Redis has more options on opening that connection than redisgraph.js has. I have a simple bit of code from a past project that you/re welcome to reference that shows the basics.