proper application shutdown implemented