If using pgAdmin, follow the procedure below to close connections.
From the [Tools] menu in pgAdmin, click [Server Status].
Close client connections that have been in the waiting state for an extended period.
From the transaction start time displayed under [TX Start], select connections that have been in the waiting state for an extended period. Then click the red square button to close the connections.