Chesterfield survive late scare to see off slumping Shrewsbury