Gulf of Maine Research Institute to buy Union Wharf, preserving as a pillar of Portland's waterfront