Release GIL when calculating phash