Free queue lock also on error