LPS-50049 Refactor portal-impl pt.1
LPS-50049 Use better system api
LPS-50049 No need to flush before close
LPS-50049 Source formatting
LPS-50049 fix confusing line
LPS-50049 SF