Political upheaval offers Erdogan chance to heal party wounds