Fix name_list.

This fixes two problems with name_list:  The possible dead-lock when calling name_list while syncing, and disappearing names when they are currently pending.

Please test that the modified name_list is still performance-wise as good as the unpatched one (in particular, better than before khal did his initial changes).  It should be.