proper shutdown sequence in BDM.py and ArmoryQt.py
refactored in TiabTest