Added support for cleanly closing the sentiment analyzer