BUILD: Fix a race condition with the reset-debug make target

Fixes #544