Outgoing president apologizes to Iranians for hardships