The space environment of Mercury at the times of the second and third MESSENGER flybys