A lockdown at four schools in Keene, N.H., brought on by a police search for a man with a gun has ended after the man turned himself in.