Wait for SQS to be empty before deleting arrays.

Change-Id: I24cb6aab35a2ab87b0f77318ac17a0dfe58bd7be