Add "shutdown" method which prevents Segmentation fault if "threaded=True"