fixing closing threads and app