Release locks when the device file is closed.