prevent another cursor leak

if two queries happen because the first failed to find one with the apn discriminator, one cursor is leaked