Fixed a bug causing connections to stay open too long.