Patriots late TD beats Cowboys