If you are sure about the correct ports being opened then it could be that the postgres database is performing with slow response. Slow responses ciuld result in connection error. Having a lot of security rules and combined with many custom properties could be the root causing this behaviour.
To resolve this you can try to change the ReadAccessControlMode parameter in your Repository.exe.config from EntityFrameworkFiltering to RepositoryFiltering. After the change you should restart your Qlik Sense Repository service.
Plees ekskuse my Swenglish and or Norweglish spelling misstakes