Sri Lanka extends state of emergency before being elected president