Modified cleanup flow to avoid segfault

Possible case if modded_request gets deallocated in case of error
Avoid segfault when a request is not actually built
Moved tests to integ subdir and added new tests