Fixing the bash scripts.

Added a trap to run. Added a cleanup script.