Set current device to array device before releasing array
Set current device to array device before releasing array

* Arrays were being freed prematurely because the device associated
  with the array was not active. This change makes sure that we call
  setDevice before the memory is freed so we find the correct pointer
  in the memory manager.

9prady9/arrayfire,arrayfire/arrayfire,arrayfire/arrayfire,arrayfire/arrayfire,umar456/arrayfire,9prady9/arrayfire,9prady9/arrayfire,9prady9/arrayfire,umar456/arrayfire,umar456/arrayfire,arrayfire/arrayfire,umar456/arrayfire