Libnetapi: fix abortion of file requests.

* We didn't wait for the thread to terminate, so the thread could use
the object after deletion.