Man is not allowed to be alone with a woman, in a closed place, or in a place that hidden from people’s sight. This kind of behaviour will drag that man and woman to zina (adultery).
Because when a man be alone with a woman, just the two of them, then third one is shaytaan. Shaytaan will tempt them to do zina.
The Prophet (ﷺ) said:
لَا يَخْلُوَنَّ أَحَدُكُمْ بِامْرَأَةٍ فَإِنَّ الشَّيْطَانَ ثَالِثُهُمَا
“No man is alone with a woman but the third one present is the shaytaan” [At-Tirmidhi, classed as Saheeh by al-Albani in Saheeh at-Tirmidhi].
The Prophet (ﷺ) also said:
لاَ يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ إِلاَّ وَمَعَهَا ذُو مَحْرَمٍ
“No person (man) should be alone with a woman except when there is a Mahram with her” [Bukhari & Muslim].
Shaytaan will use all means to make you fall into sin. Because women are the most harmful trial for men.