APT && misc : better app exiting code, fixed APPLICATION and BASE mem leak