Bugfixes for non-syncing files

Shaftlog sometimes did not replicate all changes to files completely, even though it had a lot of time to do so. This fixes bug #20, which caused the visible issues and moves some code around to ensure there are no possible race conditions in setting up watches. There should be no remaining races in the current code, which should work perfectly if inotify watches never drop events. Implementing issue #19 would handle the rest of the corner cases.