Fixed misplaced try/finally. Added initial socket request conditional