Fix infinite loop when fopen failed when obtaining lock

If for some reason fopen() fails in obtainReadLock() or
obtainWriteLock(), the function now returns with false instead of
needlessly trying to acquire a lock.

The original issue had the "false" $handle caused an infinite loop in
the do-while block.
Merge pull request #1820 from owncloud/flock-fopenfailedfix

Fix infinite loop when fopen failed when obtaining lock