if manual setup is open, close it after successful connection, fix #331

This moves the manual setup toggle code into a function. Also fixes #331 in that the manual setup area is only closed on successful connection.

Please test @Xenopathic @zinks- @PoPoutdoor 

And have a look at the code @DeepDiver1975 ;)