opened position was closed on exiting the EA?

 
Is this normal? I used an EA to open a position but it was exited when I detached the EA from the chart? Is this the normal behaviour? Thanks.
 
Check your deinit function
 
Well, I didn't have that function in my EA. Is that the problem? I thought it should be the opposite.
Reason: