A man who claimed to have accidentally shot his girlfriend ended up turning the gun on himself after a five-hour SWAT standoff at a Katy-area apartment, authorities say.