Added file locking to ensure that only one apricot server is running