Pakistan defeat Bangladesh by an innings in race against dying light