Restored cleanup scripts to functions

Resolves https://github.com/STH-Dev/linux-bench/issues/34