Nearly Tight Bounds on the Encoding Length of the Burrows-Wheeler Transform