Moves connection closing to finally