diff --git a/org/postgresql/core/v3/ProtocolConnectionImpl.java b/org/postgresql/core/v3/ProtocolConnectionImpl.java
index 4ecac6c..78e1bca 100644
--- a/org/postgresql/core/v3/ProtocolConnectionImpl.java
+++ b/org/postgresql/core/v3/ProtocolConnectionImpl.java
@@ -126,7 +126,16 @@ class ProtocolConnectionImpl implements ProtocolConnection {
     public void close() {
         if (closed)
             return ;
-
+        try
+        {
+            executor.tryCurrentCopyCancel();
+            sendQueryCancel();
+        }
+        catch (SQLException e)
+        {
+            if (logger.logDebug())
+                logger.debug("Discarding SQLException on close:", e);
+        }
         try
         {
             if (logger.logDebug())
diff --git a/org/postgresql/core/v3/QueryExecutorImpl.java b/org/postgresql/core/v3/QueryExecutorImpl.java
index 37a57f5..ab2c953 100644
--- a/org/postgresql/core/v3/QueryExecutorImpl.java
+++ b/org/postgresql/core/v3/QueryExecutorImpl.java
@@ -736,6 +736,12 @@ public class QueryExecutorImpl implements QueryExecutor {
         op.init(this, rowFormat, fieldFormats);
     }
 
+    void tryCurrentCopyCancel() throws SQLException {
+        if (lockedFor instanceof CopyOperation) {
+            cancelCopy((CopyOperationImpl) lockedFor);
+        }
+    }
+
     /**
      * Finishes a copy operation and unlocks connection discarding any exchanged data.
      * @param op the copy operation presumably currently holding lock on this connection
