Treasurer Josh Frydenberg says states should not act hastily to close borders amid five COVID-19 cases being diagnosed in Sydney.