Police say traffic stop turned violent; man almost got officer's gun