2000 connections in TIME_WAIT state does not look that much.
Compare this to the output of:
# cat /proc/sys/net/ipv4/ip_local_port_range
which would typically be 32768 61000
and can be enlarged if necessary.
It would be a problem if you exhausted that range, though.
If you're worried about that, you could set /proc/sys/net/ipv4/tcp_tw_reuse
to 1, which would make the sockets in TIME_WAIT state disappear much faster.
See this related question on serverfault.com for some background.
On the other hand, if you have lots of connections in ESTABLISHED
state, consider a connection pooler as per @FrankHeikens answer.
Note that the pooler itself is not supposed to reduce the number of connections in TIME_WAIT state, though, since these will just sit between your app and the connection pooler instead of sitting between your app and postgresql. The pooler is mainly meant to reduce the number of connections established to the database per unit of time, which is not exactly the same issue.