Fix shutdown problem

Make the python interpreter exit when any thread encounters an error.

Change-Id: I583f4afc67564390e3b2c74b85d82e77d8105312