Implemented Application shutdown