add close app functionality