release lock in case of a fatal error