What happens if another application is using `port`? I believe that case is not handled yet.
Secondly, I think it is more consistent and easier to ignore the lockfiles at all and instead perform a checkalive status on the port.