Investment and liquidation in renegotiation-proof contracts with moral hazard