code to release locks