properly downap when exit program