Custom "mouse" gestures for Trackpad on Macbook Pro and Magic mouse
Not so sure about the Magic Mouse, but for the trackpad there are a number of options.

jitouch looks very customisable, but costs.

BetterTouchTool works with the Magic Mouse. It gives you a PrefPane that lets you assign loads of gestures with loads of actions, including opening Apps. I'm sure it has capability to close windows as well. 

Hope this helps!