A major military exercise involving NATO forces from across the world off Scotland's west coast has ended.