Just keep a cantrip that requires concentration and cast it at the end of battle. One time I had party members walk into a spell I had cast and it's never happened again through 6 playthroughs. It's a you problem if it keeps happening. Sorry.