To close a container you can use Esc (close) or Space (take all). Right clicking the UI will also close windows, and open containers will automatically close if you walk away from them.