Auto App Killer is a tweak that does just that and helps you save precious RAM and keep your iDevice running smoothly. There have been tweaks that kill all background apps at once, but this is different. You can configure this tweak to kill only the apps that arent working in the background.

It cost $1.49 from BigBoss repo but cracked versions will appear soon enough

*Thanks to iJailbreak for info