Fix problem with hanging lock after fork.