Try to fix memoryleak coming from matplotlib