Ensure context popping can only be done immediately.