Fixed deletion code in temporary file creation/deletion function,

Split level backup process into separate function