Clean up the self references and unlock the lock