Enhance resource management

Consistently close HTTP connections