Fix bug : window service crash and add greatful close