ESP32 after Wifi and bluetooth off - not able to connect to Wifi again.

i tired it like it is described in this article on gidhub https://github.com/espressif/arduino-esp32/issues/1077
i stoped wifi and bluetooth on the first core of the ESP with the commands in the loop().
if(((now.hour() == 22) && (now.minute() == 0) && (now.second() == 0))) 

WiFi.mode(WIFI_OFF);
btStop();
}

but after the lines below there is only a connection for about one second than its disconnected again.
the wifi connection is executed from the second core. 
WiFi.mode(WIFI_STA);
WiFi.config(local_ip, gateway_ip, subnet_mask, dns_ip);

WiFi.begin(ssid, pass);

while (WiFi.status() != WL_CONNECTED)
{
Serial.println(WiFi.status());
delay(500); 
}

if it is desired, i could post the full code, but maybe anyone had the same problem like me.