Change assert to PlatformException to enable debug of ooiion-1327
fix exception check
Merge pull request #1376 from MauriceManning/1327_rebase2

ooiion-1327 Fix validation check in _instruments_shutdown_and_terminate