Fix issues with shutdown/postsend functions

Summary: The comment was wrong, you could remove elements
from the array as well as add them.

It also seems plausible that the entire m_shutdown array could be
reallocated (eg by registering the first postsend function while
iterating the shutdown functions), invalidating the array reference
that we were iterating over.

Reviewed By: @jdelong

Differential Revision: D1610874