Laying people off reduces one of the biggest costs to an organization, thus making it more profitable (even if in the short term), thus the stock price rises. Stocks are always forward looking and investors believe that by cutting down costs and re-focusing will make amazon worth more in the future.