Adding error handling and cleaning up jenkins call