Use a lock port to ensure parent has exited (fixes #450)