Swedish premier formally resigns after Social Democrats concede election defeat