Energy was the only S&P/ASX 200 Index (ASX: XJO) market sector to finish in the green as the war in Iran continued to create uncertainty.