Use loop to check if copy to clipboard finishes.