Allergan posts loss as it writes down Teva holdings