How can I change the name of audio file, that used to be played?

I want to create the program the creates list of files in directory. When you click the name once it should play file, and when twice dialog appears, which ask you to change the name of sample. The problem is that, when I am trying to change the file name, and the sound is playing, I got exception, that the file cannot be changed, because it is used by another process. I tried to close the stream with close method(ais.close()) but it doesn't help. Could you tell me how to detach file from the process? Here is my play method:

File sample = fileList.get(index);
    try {
        Clip clip = AudioSystem.getClip();
        AudioInputStream ais = AudioSystem.getAudioInputStream(sample);
        clip.open(ais);
        clip.loop(0);
    } catch (LineUnavailableException ex) {
        Logger.getLogger(MainList.class.getName()).log(Level.SEVERE, null, ex);
    }

The way of playing the wav file is taken from this post: How can I play sound in Java?


ANSWERS:


Make sure that you close() clip, too.



 MORE:


 ? Adobe flex convert ".ogg" file with Ogg Vorbis Encoder for being played with Sound class
 ? Adobe flex convert ".ogg" file with Ogg Vorbis Encoder for being played with Sound class
 ? Adobe flex convert ".ogg" file with Ogg Vorbis Encoder for being played with Sound class
 ? Using Ogg Vorbis in Flash/Flex applications
 ? Looping OGG files with Adobe Alchemy
 ? Convert wav to ogg vorbis in Python
 ? Sequentially concatenate multiple ogg vorbis files into a single file with .NET?
 ? Playing ogg Sound with loop
 ? Using Ogg Vorbis SPI for decoding .ogg files fails for small file sizes
 ? How to buffer and play sound data from OGG files with Java Sound