Implemented the quit method