handle CTRL_CLOSE_EVENT
move the '_terminate' function definition