process lock & clean up