                                In the

       United States Court of Appeals
                   For the Seventh Circuit
                      ____________________
Nos. 12-3624 & 13-3052
UNITED STATES OF AMERICA,
                                                              Plaintiff

                                  v.


ROGERS CARTAGE COMPANY,
                                               Defendant-Cross Claim
                                       Third/Party Plaintiff-Appellant,

                                  v.

MONSANTO COMPANY, et al.,
                                           Defendants-Cross Claim
                                 Third/Party Defendants-Appellees.
                      ____________________

          Appeals from the United States District Court for the
                       Southern District of Illinois.
        No. 3:99-cv-00063-GPM-PMF — G. Patrick Murphy, Judge.
                      ____________________

        ARGUED JANUARY 6, 2014 — DECIDED JULY 27, 2015
                   ____________________

      Before EASTERBROOK, WILLIAMS, and TINDER, Circuit Judg-
es.
2                                    Nos. 12-3624 & 13-3052

    TINDER, Circuit Judge. The villages of Sauget and Caho-
kia, Illinois, located along the east bank of the Mississippi
River just south of East St. Louis, are home to a three-and-a
half-mile storm water conveyance channel known as Dead
Creek. The name is morbid, but fitting. For more than a cen-
tury, the area has been dominated by industrial activity, and
for much of that time, Dead Creek was the recipient of a
broad array of waste materials, including polychlorinated
biphenyls (“PCBs”). Because of its extensive contamination,
the creek became the center of a cleanup site designated by
the U.S. Environmental Protection Agency (“EPA”) as Sau-
get Area 1. In 1999, the government sued several potentially
responsible parties (“PRPs”) regarding the cleanup of Sauget
Area 1, and many of those PRPs brought contribution claims
against one another. One PRP, Rogers Cartage Company,
settled with the other PRPs, but later it sought contribution
from them again via a third-party complaint in a separate
action. After that third-party complaint was severed and
transferred back to the EPA action, the district court dis-
missed it and imposed sanctions against Rogers Cartage
based on the settlement agreement. Rogers Cartage appeals
those decisions, and we affirm.
    I.   BACKGROUND
    In 1999, the United States filed a complaint under the
Comprehensive Environmental Response, Compensation
and Liability Act of 1980 (“CERCLA”), seeking to recover
costs incurred by the EPA in removing hazardous substanc-
es from a site known as Sauget Area 1, which follows Dead
Creek through the Villages of Sauget and Cahokia, Illinois,
just south of East St. Louis. Monsanto Company and Solutia,
Inc. were among the original defendants in the case. From
Nos. 12-3624 & 13-3052                                         3

the early 1900s until 1997, Monsanto operated chemical
plants in Sauget, Illinois, and St. Louis, Missouri. During
that time, Monsanto disposed of chemical waste from those
plants, including PCBs and other hazardous substances, at
waste disposal sites within Sauget Area 1. In 1997, Monsanto
spun-off its chemical business to Solutia, and Solutia agreed
to indemnify Monsanto against any environmental claims
relating to that business.
    Monsanto and Solutia filed a third-party complaint
bringing several new parties into the action, including Rog-
ers Cartage Company, which formerly operated two truck-
ing depots near (but not within) Sauget Area 1, one in the
Village of Sauget and one in the Village of Cahokia. Monsan-
to and Solutia sought contribution from Rogers Cartage
based on the allegation that Rogers Cartage washed its
trucks at these two depots after hauling hazardous substanc-
es, releasing those substances into drainage systems that ul-
timately made their way into Dead Creek, thus contributing
to the pollution of Sauget Area 1. The government subse-
quently amended its complaint to add Rogers Cartage as a
defendant, and several other defendants brought cross-
claims against Rogers Cartage based on the same theory.
    In 2000, Monsanto merged with Pharmacia & Upjohn,
Inc., creating the new entity Pharmacia Corporation. In 2001,
Pharmacia was substituted for Monsanto as a party.
   In late 2003, the district court held a bench trial to resolve
the government’s claims against Rogers Cartage. Ultimately,
the court found that the government had not established by
a preponderance of the evidence that the discharges from
Rogers Cartage’s trucking depots ever made their way into
4                                     Nos. 12-3624 & 13-3052

Dead Creek. Therefore, the court ruled in favor of Rogers
Cartage.
    After the bench trial, Rogers Cartage moved to dismiss
the contribution claims brought against it by Pharmacia, So-
lutia, and other defendants. The district court granted that
motion, reasoning that those claims failed as a matter of law
because Rogers Cartage had been found not liable on the
claim brought by the government under CERCLA § 107, 42
U.S.C. § 9607. At that point, all claims by or against Rogers
Cartage were dismissed with prejudice.
    In June 2007, the Supreme Court decided United States v.
Atlantic Research Corp., 551 U.S. 128 (2007), marking a change
in the law and establishing that potentially responsible par-
ties that incur voluntary cleanup costs may seek contribution
from other potentially responsible parties under CERCLA
§ 107. In light of this decision, Pharmacia and Solutia sought
leave to file an amended cross-claim against Rogers Cartage,
arguing that their contribution claims were no longer deriva-
tive of the government’s claims against Rogers Cartage. The
district court granted the motion, and an amended cross-
claim was filed bringing Rogers Cartage back into the case.
Subsequently, two other defendants, Cerro Copper Products
Co. (now Cerro Flow Products, Inc.) and Exxon Mobil Oil
Corporation, were also permitted to file amended cross-
claims against Rogers Cartage based on Atlantic Research.
   Rogers Cartage subsequently filed counterclaims against
Pharmacia, Solutia, Cerro, and Exxon Mobil, seeking contri-
bution from those companies based on their releases of haz-
ardous substances in Sauget Area 1. In the counterclaim
against Pharmacia and Solutia, Rogers Cartage alleged that
Monsanto Company had arranged for the transport and dis-
Nos. 12-3624 & 13-3052                                        5

posal of hazardous substances by Rogers Cartage without
informing Rogers Cartage of the nature of the substances in-
volved.
    In February 2011, Pharmacia, Solutia, Cerro, and Exxon
Mobil settled their claims against Rogers Cartage for
$7,500,000. However, the settlement agreement provided
that Rogers Cartage would be required to pay only $50,000
of that amount itself, so long as it cooperated in the effort to
recover the difference from its insurance carrier, Travelers.
The agreement also provided that Pharmacia, Solutia, Cerro,
and Exxon Mobil would fund any coverage dispute with
Travelers.
    The settlement agreement further provided for the re-
lease of all claims between the parties “pertaining to the
Sauget Area 1 and 2 Sites,” including any claims “brought or
alleged, or which could have been brought or alleged” in the
EPA action. The agreement defined the “Sauget Area 1 Sites”
to include “the geographic area so named and identified by
the United States Environmental Protection Agency (‘U.S.
EPA’),” and “any portion of any property constituting a
drainage pathway, to the extent it is contaminated by such
drainage, to or from Dead Creek.” The agreement also con-
templated that cleanup of Rogers Cartage’s Cahokia depot
would be paid for out of the settlement proceeds. Specifical-
ly, it provided that a portion of any insurance recovery
above $3 million would be placed in a trust account which
Rogers Cartage could use to pay for, inter alia, “any claims
against Rogers regarding contamination at the Cahokia facil-
ity alleged to have been operated by Rogers.”
  Rogers Cartage leased the land where its Cahokia depot
was located from ConocoPhillips Pipe Line Company, which
6                                      Nos. 12-3624 & 13-3052

is now Phillips 66 Pipeline LLC. In June 2011, Phillips 66
(then ConocoPhillips) filed a separate action against Rogers
Cartage, seeking contribution for the costs it incurred in vol-
untarily cleaning up its Cahokia property. In May 2012,
Rogers Cartage filed a third-party complaint against Phar-
macia, Solutia, and an entity it called “Old Monsanto,” ap-
parently referring to the former Monsanto Company that no
longer exists. In its third-party complaint, Rogers Cartage
again alleged that Monsanto arranged for the disposal of
hazardous substances at the Cahokia property.
    Monsanto, Solutia, and Pharmacia (collectively, “MS&P”)
moved to dismiss Rogers Cartage’s third-party complaint in
the Phillips action on the grounds that it was barred by the
settlement agreement in the EPA action and otherwise failed
to state a claim upon which relief could be granted. In the
alternative, MS&P moved to sever the third-party complaint
and transfer it to the EPA action so that it could be consid-
ered by the judge who had previously approved the settle-
ment agreement. The motion was granted to the extent that
it requested severance and transfer, and the EPA action was
reopened for that purpose.
    In the EPA action, MS&P moved to enforce the settle-
ment agreement and dismiss Rogers Cartage’s recently
transferred third-party complaint. At a hearing on October
15, 2012, the district court orally granted that motion, finding
that the settlement agreement unambiguously encompassed
claims for cleanup of the Cahokia property. At the end of the
hearing, the court asked MS&P’s counsel to quickly move for
attorney’s fees if he intended to do so.
   On October 19, 2012, Solutia moved for sanctions against
Rogers Cartage, its attorney (Robert Schultz), and Travelers
Nos. 12-3624 & 13-3052                                                          7

under 28 U.S.C. § 1927, Federal Rule of Civil Procedure 11,
and the court’s inherent power, seeking $200,000 in attor-
ney’s fees. Among other things, Solutia argued that Rogers
Cartage’s third-party complaint was frivolous because it was
plainly barred by the settlement agreement.
    On November 14, 2012, the district court granted Solu-
tia’s motion for sanctions, reasoning simply that Rogers
Cartage “filed a complaint in the face of an unambiguous
settlement agreement.” The court ordered Rogers Cartage to
pay Solutia $200,000 in fees, but it did not impose any sanc-
tions on Mr. Schultz or Travelers. In doing so, the court pur-
ported to rely on all three of the bases suggested by Solutia:
§ 1927, Rule 11, and the court’s inherent power.
    Rogers Cartage has filed two notices of appeal. The first
appeal must be dismissed as premature, 1 but the second pre-
sents all issues for resolution. In the second notice of appeal,
Rogers Cartage challenges both the district court’s dismissal
of its third-party complaint and the district court’s sanctions
order.



1 We have jurisdiction over “appeals from all final decisions of the district
courts of the United States.” 28 U.S.C. § 1291. A final decision is “‘one which
ends the litigation on the merits and leaves nothing for the court to do but
execute the judgment.’” Riley v. Kennedy, 553 U.S. 406, 419 (2008) (quoting
Catlin v. United States, 324 U.S. 229, 233 (1945)). In this case, Rogers Cartage’s
first notice of appeal was filed after the district court orally granted MS&P’s
motion to dismiss, but before the court ruled on Solutia’s motion for sanc-
tions. Moreover, the court had indicated that a written order on the motion
to dismiss would follow. Thus, at the time Rogers filed its first notice of
appeal, the litigation was ongoing, and the district court had more work to
do than simply executing the judgment. Because the first appeal was filed
prior to a final decision on the merits, we conclude that it must be dismissed
for lack of jurisdiction.
8                                      Nos. 12-3624 & 13-3052

 II.   DISMISSAL
    MS&P moved to dismiss Rogers Cartage’s third-party
complaint under Federal Rule of Civil Procedure 12(b)(6),
arguing that it was barred by the settlement agreement. On
appeal, Rogers Cartage first argues that the district court
committed procedural error in granting the motion because
it was based on an affirmative defense and relied on facts
not alleged in the third-party complaint, namely, the content
of the settlement agreement. Rogers contends that the dis-
trict court should have converted the motion into a motion
for summary judgment and given Rogers an opportunity to
present evidence in response.
    Although MS&P moved for dismissal under Rule
12(b)(6), the problem it identified with the third-party com-
plaint was not that Rogers failed to state a claim; “the prob-
lem [was] that [Rogers] signed a release waiving the right to
make a claim.” Yassan v. J.P. Morgan Chase & Co., 708 F.3d
963, 975 (7th Cir. 2013). Because the release of a claim is an
affirmative defense, MS&P should have raised it and then
moved for judgment on the pleadings under Rule 12(c). See
Carr v. Tillery, 591 F.3d 909, 913 (7th Cir. 2010). “Though dis-
trict courts have granted Rule 12(b)(6) motions on the basis
of affirmative defenses and this court has affirmed those
dismissals, we have repeatedly cautioned that the proper
heading for such motions is Rule 12(c), since an affirmative
defense is external to the complaint.” Brownmark Films, LLC
v. Comedy Partners, 682 F.3d 687, 690 n.1 (7th Cir. 2012).
However, we have found such procedural missteps harmless
when all the facts necessary to rule on the affirmative de-
fense are properly before the court on the motion to dismiss.
Nos. 12-3624 & 13-3052                                        9

See Yassan, 708 F.3d at 975; Brownmark Films, 682 F.3d at 690;
Carr, 591 F.3d at 913.
    Rogers Cartage argues that the settlement agreement
should not have been considered by the district court with-
out converting MS&P’s motion into a motion for summary
judgment and giving Rogers notice and an opportunity to
present evidence in response to the motion. In general, if
“matters outside the pleadings are presented to and not ex-
cluded by the court, the motion must be treated as one for
summary judgment under Rule 56. All parties must be given
a reasonable opportunity to present all the material that is
pertinent to the motion.” Fed. R. Civ. P. 12(d). However,
“the failure to afford such procedure will not necessarily
mandate reversal unless ‘the record discloses the existence of
unresolved material fact issues,’ or ‘the parties represent that
they would have submitted specific controverted material
factual issues to the trial court if they had been given the op-
portunity.’” Woods v. City of Chicago, 234 F.3d 979, 991 (7th
Cir. 2000) (quoting Milwaukee Typographical Union No. 23 v.
Newspapers, Inc., 639 F.2d 386, 391 (7th Cir. 1981)).
    Here, the language of the settlement agreement and Rog-
ers Cartage’s third-party complaint is undisputed, and Rog-
ers has not identified any evidence (other than that which it
actually presented at the hearing on the motion to dismiss)
that would have had any bearing on the motion. Indeed, as
discussed below, the settlement agreement is unambiguous
and therefore no external evidence was necessary to deter-
mine whether it barred Rogers Cartage’s third-party com-
plaint. As a result, we find no reversible procedural error in
the district court’s dismissal of that complaint.
10                                    Nos. 12-3624 & 13-3052

    Turning to the substantive issues relating to that dismis-
sal, we first note that “[w]e review an order enforcing a set-
tlement only for an abuse of discretion.” Newkirk v. Vill. of
Steger, 536 F.3d 771, 773 (7th Cir. 2008). “A settlement
agreement is a particular kind of contract, and so contract
law (here, the law of Illinois) governs.” Id. at 774. Rogers
Cartage argues that the settlement agreement was intended
to cover only the cleanup of Sauget Area 1 and Sauget Area
2, relying on the fact that the release provisions do not men-
tion the Cahokia facility. However, “[a] contract must be
construed as a whole, viewing each provision in light of the
other provisions.” Thompson v. Gordon, 948 N.E.2d 39, 47 (Ill.
2011). Here, the settlement agreement provided for the re-
lease of all claims between the parties “pertaining to the
Sauget Area 1 and 2 Sites,” and it defined the “Sauget Area 1
Sites” to include “any portion of any property constituting a
drainage pathway, to the extent it is contaminated by such
drainage, to or from Dead Creek.”
    Rogers Cartage maintains that its Cahokia depot was not
a drainage pathway to Dead Creek, and it argues that in or-
der to determine otherwise, the district court would have
had to consider evidence that cannot be considered on a mo-
tion to dismiss. This argument misses the point. The theory
of liability underlying MS&P’s contribution claims against
Rogers Cartage in the EPA action was that contaminants re-
leased at Rogers Cartage’s two trucking depots drained into
Dead Creek and therefore contributed to the contamination
in Sauget Area 1. Whether that theory is true is irrelevant.
The parties settled any claims they may have had against
each other, assuming that it was true. Therefore, under the
settlement agreement, Rogers Cartage’s Cahokia depot is
Nos. 12-3624 & 13-3052                                       11

considered a drainage pathway to Dead Creek, and it is in-
cluded in the definition of the “Sauget Area 1 Sites.”
    Moreover, the agreement provided that a portion of any
insurance recovery above $3 million would be placed in a
trust account which Rogers Cartage could use to pay for, in-
ter alia, “any claims against Rogers regarding contamination
at the Cahokia facility alleged to have been operated by
Rogers.” This provision would have little import if Rogers
could still sue MS&P for the cleanup of its Cahokia depot,
and contracts should not be construed “in a manner that
would nullify or render provisions meaningless.” Thompson,
948 N.E.2d at 47.
    Rogers Cartage contends that releases are to be construed
narrowly under Illinois law, but rules of construction come
into play only when a contract is ambiguous. Maddux v.
Blagojevich, 911 N.E.2d 979, 988 (Ill. 2009). Rogers also relies
on deposition testimony from MS&P’s lawyer suggesting
that the settlement agreement was not intended to encom-
pass the cleanup of the Cahokia facility. However, a court
can consider extrinsic evidence to determine the parties’ in-
tent only when a contract is ambiguous. See Thompson, 948
N.E.2d at 47. “If the words in the contract are clear and un-
ambiguous, they must be given their plain, ordinary and
popular meaning.” Id. That is precisely what the district
court did in enforcing the settlement agreement. Therefore,
we affirm the dismissal of Rogers Cartage’s third-party
complaint.
III.   SANCTIONS
   The district court granted Solutia’s motion for sanctions
and ordered Rogers Cartage to pay $200,000 in attorney’s
12                                      Nos. 12-3624 & 13-3052

fees based on its finding that Rogers “filed a complaint in the
face of an unambiguous settlement agreement.” In doing so,
the court purported to rely on all three of the bases suggest-
ed by Solutia: 28 U.S.C. § 1927, Federal Rule of Civil Proce-
dure 11, and the court’s inherent power. Under any of these
authorities, we review the district court’s sanctions order for
abuse of discretion. Lightspeed Media Corp. v. Smith, 761 F.3d
699, 708 (7th Cir. 2014) (§ 1927); Tucker v. Williams, 682 F.3d
654, 661 (7th Cir. 2012) (inherent power); Golden v. Helen
Sigman & Assocs., Ltd., 611 F.3d 356, 363 (7th Cir. 2010) (Rule
11).
    To the extent the court relied on § 1927 in imposing sanc-
tions against Rogers Cartage, it abused its discretion. That
statute provides as follows:
       Any attorney or other person admitted to con-
       duct cases in any court of the United States or
       any Territory thereof who so multiplies the
       proceedings in any case unreasonably and
       vexatiously may be required by the court to
       satisfy personally the excess costs, expenses,
       and attorneys’ fees reasonably incurred be-
       cause of such conduct.

28 U.S.C. § 1927. Under the statute, sanctions may be levied
against an attorney who files a claim that is “without a plau-
sible legal or factual basis and lacking in justification.” Light-
speed, 761 F.3d at 708 (quoting Walter v. Fiorenzo, 840 F.2d
427, 433 (7th Cir. 1988)) (internal quotation mark omitted).
But as MS&P concedes, § 1927 cannot be used to impose
sanctions against a party.
Nos. 12-3624 & 13-3052                                          13

    MS&P argues that we should remedy the district court’s
mistake by finding “that the sanction applies to both Rogers
and its counsel, and that the division of payment should be
left to them.” However, the district court’s order is not sus-
ceptible to such an interpretation. See Memorandum and
Order at 3, United States v. Rogers Cartage, No. 3:99-cv-63-
GPM (S.D. Ill. Aug. 21, 2013), ECF No. 907 (“Rogers Cartage
is ORDERED to pay attorney fees and costs to Solutia, Inc.
in the amount of $200,000.”). Therefore, we cannot affirm the
district court’s sanctions order based on § 1927.
     The district court also abused its discretion to the extent
it relied on its inherent power in sanctioning Rogers Cartage.
It is true that “the inherent power of a court can be invoked
even if procedural rules exist which sanction the same con-
duct.” Chambers v. NASCO, Inc., 501 U.S. 32, 49 (1991). But
“when there is bad-faith conduct in the course of litigation
that could be adequately sanctioned under the Rules, the
court ordinarily should rely on the Rules rather than the in-
herent power.” Id. at 50. And when the court chooses to ex-
ercise its inherent power, it should explain “why Rule 11
was inadequate to serve [its] purposes.” Corley v. Rosewood
Care Ctr., Inc., 142 F.3d 1041, 1059 (7th Cir. 1998). In this case,
the district court did not explain why exercising the inherent
power was necessary. Indeed, it purported to rely on both
§ 1927 and Rule 11 in addition to the inherent power. And as
we will explain, Rule 11 was adequate for the court’s pur-
poses. Therefore, we cannot affirm the court’s sanctions or-
der based on the inherent power.
   The filing of a complaint that is precluded by an unam-
biguous settlement agreement is conduct that fits squarely
within the ambit of Rule 11. Rule 11(b) prohibits the filing of
14                                    Nos. 12-3624 & 13-3052

frivolous claims, and when a frivolous claim is made, Rule
11(c)(1) gives the court discretion to “impose an appropriate
sanction on any attorney, law firm, or party that violated the
rule or is responsible for the violation.” As discussed above,
we agree with the district court that the settlement agree-
ment unambiguously barred Rogers Cartage’s third-party
claims against MS&P. Therefore, we find no abuse of discre-
tion in the court’s conclusion that sanctions were appropri-
ate under Rule 11, and we may affirm the court’s sanctions
order on that basis.
    Rogers Cartage argues that MS&P failed to abide by Rule
11’s procedural safeguards, and therefore the court erred in
imposing sanctions pursuant to that rule. A motion for sanc-
tions under Rule 11 “must be served under Rule 5, but it
must not be filed or be presented to the court if the chal-
lenged paper, claim, defense, contention, or denial is with-
drawn or appropriately corrected within 21 days after ser-
vice or within another time the court sets.” Fed. R. Civ. P.
11(c)(2). However, we have suggested that strict compliance
with this so-called “safe harbor” provision may be excused
where there was substantial compliance, where it was im-
possible to comply, or where the party against whom sanc-
tions are sought waived compliance. See Methode Elecs., Inc.
v. Adam Techs., Inc., 371 F.3d 923, 927 (7th Cir. 2004).
   We conclude that MS&P substantially complied with
Rule 11’s safe-harbor provision in this case. MS&P’s motion
to dismiss not only contained arguments that Rogers Cart-
age’s third-party complaint was frivolous, it also included a
request for attorney’s fees. The only plausible basis for an
award of attorney’s fees would have been sanctions under
one of the authorities discussed above. As a result, Rogers
Nos. 12-3624 & 13-3052                                    15

Cartage was on notice that MS&P was requesting sanctions
in the form of attorney’s fees, and it had more than a month
to withdraw its third-party complaint before the district
court ruled on MS&P’s motion to dismiss. In sum, the dis-
trict court did not commit reversible error in imposing sanc-
tions under Rule 11.
IV.   CONCLUSION
   The appeal in Case Number 12-3624 is DISMISSED as
premature. As to Case Number 13-3052, the district court’s
dismissal of Rogers Cartage’s third-party complaint and its
order of sanctions against Rogers Cartage are AFFIRMED.
