For Job understood that he alone could free him who placed him in the power of the evil one. (16:12) Truly he was not praying to be freed from adversity like those who would procure earthly prosperity after the adversity, but he prayed to be led to high-mindedness, and so he then says, "and place me near you." For since God is the very essence of good, it is necessary that he who is placed close to God, be freed from evil. Man is placed near to God insofar as he approaches him with his mind through knowledge and love, but this happens imperfectly in the state of a sojourner on earth in which m...an suffers attacks. Because he is placed near to God, however, he is not be overcome by them. Man is perfectly placed near to God in his mind in the state of ultimate happiness in which he cannot suffer attacks, and he shows he desires this saying, "do not let the hand of anyone fight against me," because no matter how much someone would want to attack me, if I were placed perfectly near to you, no one's attack will disturb me. This is then the expectation Job had for his consolation in the midst of bitter things, hoping to be placed near to God where he could not fear attacks.
Source: Commentary on Job