Refactored code for mktemp, withtmpdir and rm cmds

Moved the runner logic for the mktemp, withtmpdir and rm commands into
the appropriate Command class; updated the unit tests.