You can close a box, or you can close the lid of a box.
In the sentence you wrote, I'd say "closing the box" would sound more natural that "to close the box".
Also, "plugging off" isn't a phrase we use in English, to pull an electric plug out of the socket is "unplugging" so you can "unplug" the light.
Using a switch (or similar) is "turning on" or "turning off", which may be where you're getting confused.
You could also "pull the plug out".
Hope that helps.