The Senate is closing in on a deal to fund the bulk of the Department of Homeland Security and end the partial government shutdown that has stretched for six weeks.