In a move that officials touted as the most significant increase in American gun regulation in decades, the Justice Department has finalized rules to close a loophole that allowed people to sell firearms online, at gun shows and at other informal venues without conducting background checks on those who purchase them.