This comes about because \chemfig
sets up some processing to do at the end of every file that is read, with \everyeof{\@nil}
(I'm not sure why it does this, but \@nil
is intentionally undefined and latex programmers use it to denote the end of a list, so it seems chemfig wants to automatically terminate some list at the end of an input file). Meanwhile, the minionpro font files are loaded "on-demand" (like other latex font files (except computer modern, which is "preloaded")).
In your example, the first time a mathmode character is needed happens to be inside \chemfig
so the font file is loaded but then at the end of the file there will be this \@nil
inserted, causing the observed error.
One workaround is to force the font to load before your \chemfig
command. For example \setbox0\vbox{$N$}
will do so without producing any output (by typesetting a mathmode $N$
and then discarding the result).