According to WoWWiki, this would work for leaving a battlefield after it's done:

/script AcceptBattlefieldPort(1, 0)

The API says that passing a 0 through this function will cause you to leave the battlefield, whether or not the battle has actually finished. This may leave you with the deserter flag if you use it before a battle has ended.

Alternatively, you can also use the /afk command after the battle has ended to leave the battlefield without causing the deserter flag to affect you.

Or /script LeaveBattlefield()

All of those should work for leaving the battlefield.