The issue is that you did not return to the starting position using the shortest path, which is via the first row in the last part of the return journey. And the reason is that you did not explore the whole maze fully before you reached the control room, so you had no idea that the top path existed.
Bear in mind that you have ample time to explore the maze fully, to clear out all the question marks, before returning to the starting position. So, explore fully first, before calculating the shortest path.