To fix #123 in v 2.0.6

Socket was not getting closed in case of gram job and ports were not
reset for both gram and gridftp use.