Using Closeable instead of AutoCloseable.
Simplified connect Promise implementation.