Release lock before exiting.