Have to find the shortest path from $a$ to $z$ using Dijkstra's Algorithm.
My understanding (albeit may be wrong) is that you go to the immediate next node which gives you the smallest sum of weights up to that node.
As such my answer came $a,d,g,k,r,n,q,p,s,z$ with total weight $17$.
But the actual answer is $a,b,e,h,l,m,p,s,z$ with weight $16$.
Where have I gone wrong?

Dijkstra maintains internally the sorted list of nodes (with a current distance from source + the parent, which gave them the distance), and updates the list according to edges of last visited node.
In your example:
Process node a (weight 0) => add nodes b (weight 2), c (weight 4), d (weight 1), $$\begin{array}{| c | c | c |} \hline \\ node & weight & parent \\ \hline d & 1 & a \\ \hline b & 2 & a \\ \hline c & 4 & a \\ \hline \end{array}$$ since list is maintained in sorted order
Process node d (weight 1) => add nodes f (weight 1 + 5), node g (weight 1 + 4) (internal list (b c g f)) $$\begin{array}{| c | c | c |} \hline \\ node & weight & parent \\ \hline b & 2 & a \\ \hline c & 4 & a \\ \hline g & 5 & d \\ \hline f & 6 & d \\ \hline \end{array}$$
Process node b $$\begin{array}{| c | c | c |} \hline \\ node & weight & parent \\ \hline e & 3 & b \\ \hline c & 4 & a \\ \hline g & 5 & d \\ \hline f & 6 & d \\ \hline \end{array}$$ (check out $c$'s weight is not updated, since we are interested in only shortest path.
Process node e $$\begin{array}{| c | c | c |} \hline \\ node & weight & parent \\ \hline c & 4 & a \\ \hline g & 5 & d \\ \hline f & 6 & d \\ \hline h & 6 & e \\ \hline \end{array}$$
To build the path, you will need to back-trace parents from $z$. In case you make an update to the node in the list - you also update its parent (already visited nodes are never added to the list again, as the distance only increases with processing)
So, back to your question, you should not proceed after the $d$ to $g$, as $g$ is not the lightest candidate at that moment.