The delete file code needs to be before the delete record code.
PHP is executed form top to bottom, currently you have the delete record being executed before the delete file code.
the delete record behavior is set to redirect to another page, the redirect is occurring before the delete file code has a change to execute.
move the delete file behaviors above the delete record behavior.