Thousands pay final respects to slain officer