Mariners survive late rally to beat A's 8-7