(PUP-1070) cleanup empty/invalid lockfiles
Currently lockfiles won't be cleaned up automatically if they're empty or contain
non numeric characters.
This commit solves this by verifying that the content of the lockfile
contains a number or otherwise return nil which will result in deleting
the pidfile.