Fix race condition with text pasting

This patch fixes race condition with text pasting:

- Copy single word
- Press Ctrl-V and keep it pressed for some time; you'll see $ signs popping here and there

The issue was introduces by https://github.com/marijnh/CodeMirror/pull/1708