Unfortunately, the game stops working when the window is not in focus, which is why AFK occurs when you take focus off the game window.