Fix for connections not being closed after reading attributes