adding proper entity manager closing and exception handling - AIRAVATA-1285