When I open a file and I am done with it. I often want to go back to the previous directory. I usually do a :w and then :q.

Vim Command to Go to the Previous Directory

If you want to go to the previous directory do

:Ex