Found race condition that caused file not to be skipped in importOnce, leading to random exceptions. Fixes #1931