def _annotations_closed(event, params):
    """Clean up on annotation dialog close."""
    import matplotlib.pyplot as plt
    plt.close(params['fig_annotation'])
    if params['ax'].selector is not None:
        params['ax'].selector.disconnect_events()
        params['ax'].selector = None
    params['fig_annotation'] = None
    if params['segment_line'] is not None:
        params['segment_line'].remove()
        params['segment_line'] = None
    params['fig'].canvas.mpl_disconnect(params['hover_callback'])
    params['fig_annotation'] = None
    params['fig'].canvas.draw()
