clean up
clean up and throw 404 error if resource is not found