Implemented the shutdown method