<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def terminate():
 """ Stops all the active Senders by flushing the buffers and closing the underlying sockets """

    with _sender_instances_lock:
        for sender_key, sender in _sender_instances.items():
            sender.close()
        _sender_instances.clear()