Isset function closing the connection