After urging from President Biden, Speaker Nancy Pelosi said the House would consider an agreement that could avert a shutdown of the nation’s freight trains.