Fix writing GPU Faiss index
As reported in by @corticalstack there is currently an error when we try to save a faiss index on GPU.

I fixed that by checking the index `getDevice()` method before calling `index_gpu_to_cpu`

Close #1859 