Fixes #66 by locking a file while writing, and temporarily disabling poll watchers while a file is locked.