Updated ordering of removing file so that exit code status is checked from the http request and not from removing the file.