Use water sent out from a dispenser to close the portal, use a flint and steel (within a dispenser) to re-open it.
(edit) I attached a screenshot on how I sorted this out on my server / testworld. On the other side is a lever to turn this on/off, the right dispenser holds the flint/steel and the left one contains one water bucket. The lever is on the right side, 'behind' the sandstone with the redstone dust on it.
I don't want it to be open all the time. I want it to be safe... If there is not a way, I'm going to make a safe base in Nether towards the Nether Portal...
EDIT: Forgot to specify.
In the nether the usual way of breaking the portal with water will not work (no water in the nether). Breaking one of the obsidian blocks will work, but there's no way to automate that. What is unsafe about portals anyway?
If you are concerned about the occasional pigman spawning, simply build a fence around the portal to keep them contained,
or build a trap that kills them when they step out of the portal.
In the top picture, it might be a little hard to see, but in front of the portal there is a wood fence post in the middle of the nether brick fences, which does not connect, and that leaves a gap you can walk through but pigmen cannot. Another option would be to just use a fence gate (if/when they "fix" that connection stuff).
In the bottom picture there is a 25 block fall onto hoppers that collect the drops and puts them into a chest. It is the world's slowest gold farm, but it keeps the zombie pigmen out of my base.