Plane pilot door got opened while flying

I’m a student pilot flying a DA62, a door sensor was having a misreading, saying the door was open when it wasn’t. The instructor said to jiggle the handle to see if the sensor would turn off. I accidentally pulled up a little too much on the handle and the door popped open mid flight. I couldn’t close the door until we had landed and slowed down. Everybody was ok. Plane student pilot door got opened mid flight, he had to hold it down until they land before it got closed properly.