finish a-start algorithm