This behaviour is a clear sample of OCD (Obsessive-Compulsive Disorder), which is obsessive thoughts that lead to repetitive actions. For the people who suffer from this condition, life is pretty hard as everything has to be done perfectly and it is difficult for others to understand the way they see things and the reason why they do what they do to feel safe. The fact Margaret needs to make sure 17 times that everything is locked and secured is because this is the way she has found to feel safe.