In SharePoint we have two types of site
A .Team site
B. Publishing site
in team site no need to check out the page and again check in ,but in publishing site we need to take care of it .
below is code to add document library on page layout in publishing site