Goldman Sachs said its profit more than doubled in the fourth quarter, boosted by companies’ growing appetite for dealmaking.