Clean up wifi connection routine