Use persistent connection for links database

Add close method to Runtime and Server to make sure
that any underlying connections are cleaned up