Address race in file locking tests

It appears the intermittent failures in the linked bug are caused
by the parent process grabbing the lock after the child has
created the file but before the child has had a chance to lock it.

In order to avoid that happening, wait until the lock has actually
been grabbed, instead of just until the file is created.

This problem does not apply to the threaded test case, and a note
as to why was added in the code.

Change-Id: Icfbdc745d129a9028b2c12d0962e4621261ee111
Closes-Bug: 1357582
Merge "Address race in file locking tests"