Call stop() before setting run=0
The previous code was setting run = 0 and then calls stop().
stop() will not deinitialize anything due to the precondition that run !=
0
Merge pull request #1 from bor0/master

Call stop() before setting run=0