CUBA'S CLOSING of the harbor where private American boats had been picking up refugees apparently brings to an end the "freedom flotilla" begun last spring. At that time and for reasons still obscure, Fidel Castro opened the gates to certain Cubans, in effect daring the United States to put up (by taking them in) or shut up about Cuba's being a prison. Jimmy Carter proclaimed "open arms" but was soon forced to react to the Castro tactic of filing the boats not so much with the particular Cubans Americans wanted but rather with those Cubans he wanted to expel -- this eventually included 1,800 known hardened criminals, 1,000 mental cases and, in their own category, thousands of homosexuals. Even after the administration started to check coastal traffic, however, refugees slipped through at a rate of 200 a day. About 9,000 Cubans (and 4,300 Haitians) have arrived since June. The Cuban boatlift has now been cut off at Mariel harbor, from which 123,000 Cubans have come to the United States since April.

The time of the freedom flotilla will be remembered, we think, as a moment when Americans yielded to their best impulses, put normal routine aside and offered refuge to a group of people rendered desperate by life in a totalitarian state. Americans could not have lived easily with themselves if they had turned down Mr. Castro's dare and become in a sense his accomplices in denying these people their freedom. Whether there was political or propaganda profit in that may be arguable, but is not very important. There was a moral necessity.

But it has to be noted that the costs of breaking precedent and taking in refugees on a hostile foreigner's terms, rather than on the United States' own, were substantial. Neither the administration in its management capacity nor the country in its reception of the refugees seemed ready to handle the load -- although the private agencies that do the actual work of resettling performed nobly as they invariably do. Riots at resettlement camps and airplane hijackings were merely the most dramatic symptoms of a dislocation that has left thousands of the new Cubans suspended still in camps without sponsors, and thousands of others flailing in the wake of failed sponsorships. The record of the half-million Cubans who arrived in earlier years provides a reason to expect that eventually most of the new arrivals will find a measure of fulfillment as Americans and will make a valuable contribution to their new home. But the current problems must be dealt with. The states and communities that have borne a disproportionate share of the burden need to be assured in specific and helpful ways that others recognize that the burden is a national one.

It is already clear that the 1980s are going to be a period when American's grapple more closely than they have in 60 years with all the separate aspects of immigration: refugees, legal immigrants, illegal immigrants -- the works. A sense is growing that although it is murderously difficult to deal with all the parts at the same time, that is the only way in which the competing values and interests can be fairly balanced off. This is the context in which the separate question of Cuban refugees will have to be treated. American policy must be more than a response to one Cuban leader's acts. It must be fitted into an overall policy for dealing with Cuba and, beyond that, into an overall immigration policy.