Apple agrees to pay €318m fine to close Italian tax case