AAL/Python: fix exception handling at exit and adapter_exit