Assuming its a closet, that opens outwards with an unprotected latch, you can use anything from the springs in click pens to a butter knife to retract the latch. If the door opens inwards (reverse bevel), a butter knife can be worked gently between the door stop and the jamb to retract the latch from the strike. Just be careful not to scar the woodwork.
Chuck