Apologies, small error in the code. stopCluster() was called without supplying the cluster object, cl, to the function. Corrected on my gist: https://gist.github.com/sjvrensburg/57c325f62c52b9df56c82ca41f81de28 [[alternative HTML version deleted]]