Goldman bought a bond portfolio on which the bank had booked a $1.8 billion loss, while also trying to raise capital for the bank in its last days.