Corrected condition errors on request attempts.

The problem was : If the connection is closed, exceptions are generated.
If the connection is open, everything runs fine but there is no need for that condition.

Reversed the condition so that it is opened only if it hasn't been before.