That can be done using a command, however that command will need to be present in any active profile (I.E. the one shown on the "Profile" dropdown on VoiceAttack's main window; included and global profiles don't have their "Profile Exec" options executed).
To prevent the device change happening whenever a profile is switched, you could check the value of the "{CMDACTION}" token to make sure it's "ProfileUnloadClose", indicating that the command is being executed because VoiceAttack is closing.
Changing devices is done using the "Change Default Audio Devices" action, as its name suggests.
Such a command could look like this:
Begin Text Compare : [{CMDACTION}] Equals 'ProfileUnloadClose'
Change multimedia playback device to: 'Speakers (Realtek Audio)'
End Condition
(obviously the device would be set to your actual device)
The command should be assigned to the "Execute a command each time this profile is unloaded" option on the "Profile Exec" tab in the profile options of any profile you want to perform this function (said profile must also contain the command; commands can be copied between profiles)