Mac app for automatically closing / opening certain apps according to profiles?
If you are willing to pay some money for it there is the excellent Keyboard Maestro which can do a lot of things. There you can close and open Apps easily.

If you do not want to spend money I suggest you take some time to learn Apple Script. This is a free scripting language provided by Apple. Alternatively you can use shell scripts but I am not so sure if you can easily check which apps are running or not.