Added option to force connection close