The electric-car maker reported net income of $2.5 billion, a result driven in part by strong growth in Tesla’s energy business.