fixes multiple leaks on save

Strange that we had to add THDoubleTensor_free(tensor); to remove the leak, but it works well.