prevent crash when switching from task manager/launcher

Tested-by: @KyokushinPL
Reported-by: @KyokushinPL