Walgreens posts Q3 gains, misses analyst expectations