Generator cooling using heat pipes