Mechanism of head assembly and DNA encapsulation in Salmonella phage P22