set permissions of pidfiles to 777

This commit also features some super minor refactoring of luigi.lock