Always change back to original directory when @tmp_directory is used
The purpose of this MR is to wrap the function that the user wishes to decorate with the @tmp_directory
decorator within a try
/finally
statement to ensure that the user always returns to the cwd
even if the function fails. This was recommended by @duncanmmacleod.