server.py: Use lock file to ensure singleton

The original way using fcntl is a bit hard to maintain the status of
server. Using a file would be simpler to understand.