improved isOpenConnection()