added closeQuietly method