Don't deadlock on closing while sending index (fixes #189)