setting a timeout to close postgres