The man who kidnapped an ex-girlfriend and held her captive for four months, then killed her and her son when they were staying with one of her relatives, has been shot and killed by police.