<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove(cls, pid):
 """Remove a pool, closing all connections :param str pid: The pool ID """

        with cls._lock:
            cls._ensure_pool_exists(pid)
            cls._pools[pid].close()
            del cls._pools[pid]