Implemented system shutdown handling in ComHandler.