SERVER-8635: fix crash caused by executing mr::State::~State() after JS exception