Demonstrate that DPDA is closed under complement by construction
I didn't have time to write this before but I found an answer. Here is what I did:

Let $O$ be the original $PDA$. We will construct a new $PDA$, call it $M$ ($M$ stands for modified).

To find the complement of $O$, we can flip final states to be non-final states and vice-versa. It is the same procedure as for finite automatas. However, there is a subtlety. The main problem is that in the original PDA $O$ the input $w$ can lead to a state $S$ which is not a final state but could perform an $\epsilon-move$ and get to an accepting state $S'$. Flipping states as mentioned above, would make $M$ end in $S$ with the input $w$ which would be a final state (causing $M$ to accept accept the input) even though it will later make an $\epsilon-move$ to $S'$, a non-accepting state. Therefore, both $O$ and $M$ will accept $w$. Something similar happens if $S$ was a final state and $S'$ a non-final state reachable from $S$ through an $\epsilon-move$.

In order to overcome this problem, we must make sure that all $\epsilon$-moves happen before we read the next symbol. That is, we will enter a reading state only when a path of $\epsilon$-moves is followed and we reach a state which has no $\epsilon$-move available. We call these latter states reading states, as they need an actual symbol to perform a new transition.

Define $M$'s states to be tuples of the form $&lt;q, n&gt;$ where $q \in Q$ ($Q$ is the set of states of the original $PDA$) and $n \in \{1, 2, 3, 4\}$.


If $\delta(q, \epsilon, X) = &lt;q', \alpha&gt;$ in $O$, let $\delta(&lt;q, 3&gt;, \epsilon, X) = &lt;&lt;q', 2&gt;, \alpha&gt;$ in $M$ if $q \in F_O$.
If $\delta(q, \epsilon, X) = &lt;q', \alpha&gt;$ in $O$, let $\delta(&lt;q, 3&gt;, \epsilon, X) = &lt;&lt;q', 3&gt;, \alpha&gt;$ in $M$ if $q \notin F_O$.
If $\delta(q, \epsilon, X) = &lt;q', \alpha&gt;$ in $O$, let $\delta(&lt;q, 2&gt;, \epsilon, X) = &lt;&lt;q', 2&gt;, \alpha&gt;$ in $M$.
If $\delta(q, \epsilon, X)$ is $undefined$ in $O$, $\delta(&lt;q, 2&gt;, \epsilon, X) = &lt;&lt;q, 1&gt;, X&gt;$ in $M$
If $\delta(q, \epsilon, X)$ is $undefined$ in $O$, $\delta(&lt;q, 3&gt;, \epsilon, X) = &lt;&lt;q, 4&gt;, X&gt;$ in $M$


In those definitions, we let states of the form $&lt;q, 2&gt;$ and $&lt;q, 3&gt;$ consume $\epsilon$-moves imitating $\epsilon$-moves of $O$ until there are no more. Then, perform an $\epsilon$-move to a reading state. Now for the reading states, 


If $\delta(q, a, X) = &lt;q', \alpha&gt;$ in $O$, let $\delta(&lt;q, 1&gt;, a, X) =  \delta(&lt;q, 4&gt;, a, X) = &lt;&lt;q', 3&gt;, \alpha&gt;$ in $M$.


By making this definition, we consume a symbol of the input and move to a state of the form $&lt;q, 3&gt;$ to begin a new series of $\epsilon$-moves.

Finally, make states of the form $&lt;q, 4&gt;$ be accepting states of $M$ if $q \notin F_O$. Also, make $&lt;q_0, 3&gt;$ the initial state of $M$ if $q_0$ is the initial state of $O$.



What we did is the following:

Create 4 "floors" of states (the second element of the tuple in states of $M$ determines in which floor we are). Floor 3 imitates $\epsilon$-moves of $O$ possibly reaching an accepting state $q$ of $O$. If that is the case, we move to floor 2; otherwise, we remain in floor 3. When there are no more $\epsilon$-moves to follow of $O$, we define $\epsilon$-moves of $M$ to reach a reading state. Floors 1 and 4 correspond to reading states. If we were on floor 3, we go to floor 4. If we were in floor 2, we reach floor 1. Only states $&lt;q, 4&gt;$ (states that are in floor 4) are accepting states of $M$, provided that $q$ is not an accepting state of $O$.

Please let me know if I made a typo at writing this. I could've easily mistaken. Also, my English is not very good so feel free to edit and rephrase things better.