SERVER-10026 fix query leak during certain error conditions