NPC Store = npcs.closest("Magic Store owner");
is causing it. initialize it when you need to in onLoop(). like this:
NPC store;
public int onLoop() {
if (needToInteractWithStore) {
store = npc.closest("Name");
if (store != null && store.interact("action")) {
// conditional sleep till widget or interface is open/not null
}
}
return 69;
}