Added proper handling to closing tabs, fixed computing offset height for bottom positioned elements