Thanks to everyone who replied, it turned out that this was the resolution; it was initially hidden by the fact we had increased debugging output to try and track down the exact point of failure but in doing so had only increased again the needed packet size. Once we removed the extra outputs the task ran and completed successfully with cleanup and removing the lock.
Thanks.
Thanks.