Tom's dream is supposed to be a glimpse into the afterlife of the chimney sweepers; the coffins of black are a conventional symbol for death, and the black ties back to chimney soot. It's very possible the phrase was chosen because a chimney, from the inside, is dark and constricting, much as a coffin is.