Gerrit Cole reaches agreement to remain with Yankees