(PUP-1150) Fix race condition in Puppet::Util::Lockfile.

Before this commit, Puppet::Util::Lockfile.lock called the locked?
method before opening the @lockfile for write. Checking that the file
doesn't exist and creating the file were not an atomic operation, which
allowed two processes to detect that the file didn't exist and open it
for write simultaneously.

This commit adds option to the File.open call:

 * File:CREAT - Creates the file if it doesn't exist.
 * File:EXCL - Fails if the file does exist.
 * File:WRONLY - Opens the file for write only.

File:EXCL is the important option, assuming all code that expects to
create this file will fail atomically if the file exists, the race
condition removed.