Preparation of nanoparticles with a membrane contactor