set permissions of pidfiles to 777

This commit also features some super minor refactoring of luigi.lock
Merge pull request #421 from spotify/erikbern/pidfile-777

set permissions of pidfiles to 777