Optimal capital structure and investment options in finite horizon